No standard JS/TS autocompletion in Jest test files
See original GitHub issueEnvironment
-
node -v
: v10.15.3 -
npm -v
: 6.9.0 -
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): 24.7.1 -
Operating system: Windows 10 Pro
Prerequisite
- are you able to run jest test from command line? Yes
- how do you run your tests from command line? (for example:
npm run test
ornode_modules/.bin/jest
)jest
,npm run test
I’m checking out VSCode, as a possible replacement for WebStorm/IntelliJ (they’re both great - just interested in knowing how to use both), so please bare with me if I’ve missed something obvious, such as a configuration setting.
This is a “pretty much” fresh VSCode install. I’ve not tweaked settings outside of installing standard extensions (eslint
, test runners, etc), and setting up some keybindings.
Steps to Reproduce
This happens in this repo.
The summary is that if I open a test file in VSCode, it doesn’t seem to get treated completely as a JS/TS file; in particular, it doesn’t have the same level of autocompletion I get when using JS/TS files.
Note in the first screenshot the file is set to “Javascript”, and VSCode not only provides autocompletion, it flags the code after the throw
as unreachable.
Now note how in the second screenshot, with the file set to "
I’m trying to tackle these things one issue at a time, but I’ve also run into a couple of other problems with this extension so far:
- Where do I actually see the output of the test runner? With the repo I linked to, I can’t even run the jest tests, even if I comment out the
throw
- I just get a red “x”, and can’t find any sign out output. - I have no gutter icons - I’m not yet ready to report this as an issue, as I think it’s likely I’m missing a vital configuration setting.
For me, the biggest difference (at least, that matters) between VSCode & IntelliJ/WebStorm is the test runner, which is what I’m hoping VSCode can match (w/ gutter icons and navigation being a big part of this).
Let me know if theses anything else I can do to help with this issue, and thanks in advance for your time 😃
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top GitHub Comments
I resolved my intellisense problem by nuking my code install on windows: Uninstall vscode Deleted code folder located at %appdata%\code Deleted .vscode folder located at %userprofile%.vscode Reinstalled from website Installed this plugin along with a couple of others.
At the command prompt I typed: react-native init myproj --template typescript
Then cd into myproj and type code . to open the folder in code. Created a test and voila - all is right with the world.
The only method that worked for me for a nodejs library with ts-config…I have saved the config just in case and planning to reapply.
Before, even when I managed to make it search for tests it was always showing 1 runned, 1 failed.