-
Notifications
You must be signed in to change notification settings - Fork 306
testPathPattern is messed up when running test #838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
looks like this might be caused by the |
hi @connectdotz okay so i tested your id with the upper case 'D' in testMatch and lower case 'd' in the testPathPattern on the console and it does not affect jest there.
dont know why the extension added the extra \ in the filename but it looks strange that the normal command has so these are the results for now. if you need something else i am happy to help you. |
Hi! I just encountered the same problem. This is the output of vscode-jest:
So, I wanted to test the command line by hand and the only way I found to make it works was to replace all the
Let me know if you need further information. EDIT: I enabled the autorun when saving files and the tests are running correctly.
Adding
|
this issue is puzzling... I could not reproduce it in windows 10. The This code has been released for a while, I would expect every windows user would have bumped into this problem if it is a general issue, but it did not seem to be... Are people who have this problem all using windows 11? using react-native x? Did it work before and something recently changed that you think might trigger the issue? |
@connectdotz I'm on Windows 10 with a normal react project. I started a new project from scratch to test and didn't manage to replicate either. Also I finally managed to run the tests from the extension. {
"jest.rootPath": "web",
"jest.jestCommandLine": "npm run test --",
"jest.autoRun": {
"watch": false
}
} I don't know why but by removing the jestCommandLine, the tests run corretly... |
@AntoninGK very valuable information 👍 Based on your observation, I went looking for hints in I see a few workarounds for this issue:
Let me know if any of the workarounds helped. |
@connectdotz thanks for these details! However, I did some digging into what you said about the command line not being well escaped. My test script of my current project is: So, switching to react-scripts solved the problem, thank you for your help! |
@connectdotz |
We have a similar problem when using
Please see log below:
|
Interestingly enough, if you Debug (instead of Run) and individual test then it works as expected. See output below:
|
@cosminstirbu during Debug it uses |
I have created a separate issue for this, with a repro project #852 |
Same issue.
But successfully to run Env:
|
@AlMiraiABC are you using npm to start the test? In your output the testPathPattern is already being double escaped. I added a new workaround (3) in comments to by-pass npm and invoke Also opened a new issue in npm npm/cli#5004 to track this external issue. |
Has it been resolved yet? I've run into the same problem |
My issueI just upgraded to npm version 8.11.0 in the context of sharepoint SPFx. The JourneyThis sent me on a journey, trying out all sorts of different jest version. Finally, I tried to set The solutionFinally, connectdotz reply, #838 (comment), led me to set `"jest.jestCommandLine": "node_modules\.bin\jest", solving all my problems. As a side note, I used the following package versions:
|
With |
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. 🎉 |
I faced the same issue as you did, but once I removed "cross-env" from the test command, all tests could be executed separately without any errors. |
This one worked for me thanks: npm install -g npm@latest |
Environment
vscode-jest version
: 4.2.1node -v
: v16.13.1npm --version
: 8.1.2npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): [email protected]your vscode-jest settings if customized:
Operating system: Windows 11
Prerequisite
npm run test
ornode_modules/.bin/jest
) npm test --watchAll=falseSteps to Reproduce
Expected Behavior
the tests should run normally
Actual Behavior
No tests found, exiting with code 1
Run with
--passWithNoTests
to exit with code 0In 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
The text was updated successfully, but these errors were encountered: