testPathPattern is messed up when running test
See original GitHub issueEnvironment
-
vscode-jest version
: 4.2.1 -
node -v
: v16.13.1 -
npm --version
: 8.1.2 -
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): react-scripts@5.0.0 -
your vscode-jest settings if customized:
- jest.jestCommandLine? npm test –
- jest.autoRun? off
-
Operating system: Windows 11
Prerequisite
- are you able to run jest test from the command line? yes
- how do you run your tests from the command line? (for example:
npm run test
ornode_modules/.bin/jest
) npm test --watchAll=false
Steps to Reproduce
- create-react-app project
- run the “renders learn react link”
Expected Behavior
the tests should run normally
Actual Behavior
my-app@0.1.0 test react-scripts test “–testLocationInResults” “–json” “–useStderr” “–outputFile” “C:\Users\smars\AppData\Local\Temp\jest_runner_my_app.json” “–testNamePattern” “renders learn react link” “–no-coverage” “–reporters” “default” “–reporters” “c:\Users\smars\.vscode\extensions\orta.vscode-jest-4.2.1\out\reporter.js” “–colors” “–watchAll=false” “–testPathPattern” “d:\\repos\\my-app\\src\\App\.test\.tsx”
No tests found, exiting with code 1
Run with --passWithNoTests
to exit with code 0
In D:\repos\my-app
6 files checked.
testMatch: D:/repos/my-app/src//tests//.{js,jsx,ts,tsx}, D:/repos/my-app/src/**/.{spec,test}.{js,jsx,ts,tsx} - 1 match
testPathIgnorePatterns: \node_modules\ - 6 matches
testRegex: - 0 matches
Pattern: d:\\repos\\my-app\\src\\App\.test\.tsx - 0 matches
for some reason the testPathPattern is messed up. it works fine when i use yarn as the command
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:18
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. 🎉
With
cross-env
, the double backslash doesn’t work. For example,cross-env NODE_ENV=test jest --testPathPattern c:\\folder\\test
won’t work, whilecross-env NODE_ENV=test jest --testPathPattern c:\\\folder\\\test
will work. This is probably the responsibility ofcross-env
but sincecross-env
is not in active development so we may have to find some other alternative.