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

No test match when running an independent test

Open cosminstirbu opened this issue 2 years ago • 1 comments

Environment

Created this issue as a followup of https://github.com/jest-community/vscode-jest/issues/838#issuecomment-1100942231

  1. vscode-jest version: 4.2.1
  2. node -v: 16.14.0
  3. npm -v: 8.3.1
  4. npm ls react-scripts: 4.0.3
  5. your vscode-jest settings if customized:
    • jest.jestCommandLine? - see .vscode in attached repro
    • jest.autoRun? see .vscode in attached repro
  6. Operating system: [fill]

Prerequisite

  • are you able to run jest test from the command line? npm run test
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) npm run test

Steps to Reproduce

Run an independent test and notice that no test was matched.

Debug an independent test and notice that it matches the test and it works as expected.

The issue seems to be with testPathPattern and the way it is escaped when running the test. testPathPattern doesn't seem to be used when debugging the test.

See attached repro project - my-app.zip

cosminstirbu avatar Apr 18 '22 07:04 cosminstirbu

Hi, thanks for the sample app, yes I can repro your issue on windows with npm 8.5. This is a known issue (see comment, npm/cli#3680, npm/exec#2). You can work around this issue by either downgrade npm to 6.x or switching to yarn.

connectdotz avatar Apr 18 '22 21:04 connectdotz

for people who had problems with testPathPattern, i.e. npm miss-interpreting the pass-through arguments: it seems npm @>=8.15 has fixed this issue. 🎉

connectdotz avatar Oct 24 '22 19:10 connectdotz