I have vscode 1.9 and I want to have intellisense for jest tests. The problem is that describe
, it
, expect
etc are globally available in jest and you don't need to import
them in your test files. So vscode will not show intellisense for them.
Is there any configuration for globals for automatic type acquisition?
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.) in JavaScript).
To access this options page, choose Tools > Options, and then choose Text Editor > C# > IntelliSense.
You have a few options in this case:
Add jest
to your package.json
:
"dependencies": { "jest": "^18.1.0" }
This only works if you are working JavaScript and do not have a tsconfig.json
.
Install @types/jest
$ npm install -D @types/jest
This should work for both JavaScript and TypeScript projects. However @types
but may be disabled by a jsconfig.json
/tsconfig.json
: http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
Create a jsconfig.json
file in the root of your workspace to specifically include jest:
{ "typeAcquisition": { "include": [ "jest" ] } }
This will only work for JavaScript projects when automatic typings acquisition is enabled.
All of these should allow VSCode to pick up jest's typings without an import
or require
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With