vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

Angular failing with nx use cases

Open Jonatthu opened this issue 7 years ago • 5 comments

Repro: https://github.com/Jonatthu/nx-angular-test

Environment

  1. node -v: v8.11.3

  2. npm -v: 6.2.0

  3. npm ls jest or npm ls react-scripts (if you haven’t ejected): [email protected] C:\angular-demo `-- [email protected]

  4. 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
  5. Operating system: Windows 10 / Mac Os Sierra

Prerequisite

  • are you able to run jest test from command line? Yes image

  • 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

image

Jonatthu avatar Oct 12 '18 23:10 Jonatthu

I have the same issue.

guysenpai avatar Dec 08 '18 08:12 guysenpai

@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)

mattarau avatar Dec 12 '19 12:12 mattarau

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?

WolfspiritM avatar Feb 25 '20 08:02 WolfspiritM

Any update on this? Setting jest.pathToJest": "npm test -- and some variations didn't work for me either.

buxel avatar Apr 01 '20 11:04 buxel