Virtual Studio Code and Jest IntelliSense Headaches Cured
My favorite IDE to work in whether free or paid is Virtual Studio Code. My favorite unit testing framework is Jest.
There are many reasons for this, however one of the biggest headaches is getting VS Code IntelliSense to work with Jest (for one reason or another it isn’t supported out of the box).
Solution
To get VS Code IntelliSense to work with Jest, we need to tell the IDE to look for a community maintained type in the VS Code jsconfig.json
file. To do this, create a file at the root of your node project named jsconfig.json
and add the following code:
{
"typeAcquisition": {
"include": [ "jest" ]
}
}
Now the IDE knows about the type and will use it for IntelliSense in your project and should make coding your unit tests a little faster.