vscode-jest
vscode-jest copied to clipboard
No test found by running the test with the ui on a single file on Windows
Environment
-
vscode-jest version
: [5.2.3] -
node -v
: [v16.13.2] -
npm -v
: [8.1.2] - your vscode-jest settings if customized:
- jest.jestCommandLine? [npm run test:dev --]
- Operating system: [Windows 11 ]
Prerequisite
- are you able to run jest test from the command line? Yes work fine with command line
- how do you run your tests from the command line? npm run test:dev [filename]
Relevant Debug Info
I can run all the tests using the UI and with command line with no problem.
I can't run test one by one by clicking the red or green arrow directly on the file this result to 'No test found error'
In C:\Users\Florian\Desktop\Apps\crm-ui 2570 files checked. testMatch: /tests//.[jt]s?(x), **/?(.)+(spec|test).[tj]s?(x) - 328 matches testPathIgnorePatterns: C:\Users\Florian\Desktop\Apps\crm-ui\dist\, C:\Users\Florian\Desktop\Apps\crm-ui\node_modules\, C:\Users\Florian\Desktop\Apps\crm-ui\src\config\test.ts - 2570 matches testRegex: - 0 matches Pattern: c:\\Users\\Florian\\Desktop\\Apps\\crm-ui\\src\\features\\offerComposition\\components\\tests\\ServiceDetailsBanner\.test\.tsx - 0 matches
But It's working when I run npm run test:dev ServiceDetailsBanner.test.tsx
Expected Behavior
Run the test when i click on the red or green arrow on a single file
Actual Behavior
No test found when I run the test by clicking on the green or red arrow on a test file
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...
This could be related to a known npm bug with TestPathPattern on windows when using the UI to run an explicit test (#838). Please see comment for the solution.
running npm v10.8 and same issue happens. testMatch: - 0 matches testPathIgnorePatterns: e2e, e2e - 895 matches testRegex: (\tests\.*|(.|\)(test|spec)).(jsx?|tsx?)$ - 105 matches Pattern: path\to\project\src_tests_\path\to\file.test.tsx - 0 matches
@josersleal, can you also show us the spawned command line and the expected pattern above?
@josersleal, can you also show us the spawned command line and the expected pattern above?
Not anymore. the tests run on terminal though. Also the tests are visible in the runner but will not run.
If you are still having problems running individual tests via the extension, please copy/paste the spawned command line from the console: see here. Or better yet, if you can create a sample repo so we can reproduce the issue here.