vscode-jest
vscode-jest copied to clipboard
Angular failing with nx use cases
Repro: https://github.com/Jonatthu/nx-angular-test
Environment
-
node -v: v8.11.3 -
npm -v: 6.2.0 -
npm ls jestornpm ls react-scripts(if you haven’t ejected): [email protected] C:\angular-demo `-- [email protected] -
your vscode-jest settings if customized:
- jest.pathToJest? [fill]
- jest.pathToConfig? [fill]
- anything else that you think might be relevant? Maybe I need a custom one but no idea which paths to put
-
Operating system: Windows 10 / Mac Os Sierra
Prerequisite
-
are you able to run jest test from command line? Yes

-
how do yo run your tests from command line? See Image please.
Expected Behavior
Get the intellisense to the spec.ts file and no errors on the jest tool about JSX
Actual Behavior

I have the same issue.
@Jonatthu one possible workaround for this problem (it worked for me) is to set the Path To Jest config in Jest configuration settings to npm test -- so that it would run using your package.json's test script.
You can also manually add it to the settings.json file:
"jest.pathToJest": "npm test -- "
If you're using yarn, just set to yarn test instead (the -- suffix is not required with yarn)
This is a big problem for me aswell. The fix with running "npm test --" or "ng test" doesn't really work. It seems to work but is only testing the main project for me. All libs are ignored even so it looks like they are tested but a testrun is not triggered when anything changes.
I thought that VSCode + Angular + Jest is one of the main usecases for this extension?! Why is there no effort put into solving that problem?
Any update on this? Setting jest.pathToJest": "npm test -- and some variations didn't work for me either.