Closed hkan0157 closed 3 months ago
I'm having the exact same issue - the test/tests show up as running, but nothing happens (and the 1min timeout is not triggered either)
https://github.com/jest-community/vscode-jest/assets/40512816/1b1e718f-72fb-4624-a501-77a551d86dba
If I create a new test file, then tests auto-run fine - it's when I want to run a specific test or file that things fail
I am in a monorepo with virtual folders setup and a custom Jest command. Settings:
{
"jest.jestCommandLine": "yarn test",
"jest.virtualFolders": [
{ "name": "components-controllers", "rootPath": "packages/support-packages/components-controllers" }
],
"jest.runMode": "on-demand",
"jest.debugMode": true,
}
Where yarn jest
is defined as stencil test --spec --
(Stencil is proxying all extra flags to Jest CLI)
vscode-jest: v6.2.2 node -v: v20.11.0 npm -v or yarn --version: yarn 4.0.2 Operating system: macOS
are you able to run jest from the command line? Yes
where do you run jest CLI from? rootPath is set to packages/support-packages/components-controllers
how do you run your tests from the command line? Using Stencil, which wraps over Jest and forwards the arguments
If I change the jest.debugMode from true to false or the other direction, a window with this error pops up:
Sometimes I also see [error] failed to schedule test for /Users/mak13180/site/esri/arcgis-web-components-migration/packages/support-packages/components-controllers/src
Hmm... do you guys have a sample repo I can try to repro? Does this happen all the time or just occasionally? Does reload/restart make any difference?
reload/restart does not fix the issue (happens again after the first run) when tests auto-run as part of creating new file or saving changes, all works fine when debugging individual test, all works fine it's only when running individual test in non-debug mode that it never completes - and such uncompleted tests are not stoppable/cancellable either
Does this happen all the time or just occasionally?
happens consistently in the condition described above. and consistently does not happen in the other conditions
do you guys have a sample repo I can try to repro?
I will try to create one tomorrow and will post the link here (might take a bit of time as the bug happens in a large proprietary monorepo)
Hmm, Jest output when run using vscode-jest contains this:
Ran all test suites matching /\/|U|s|e|r|s|\/|m|a|k|1|3|1|8|0|\/|s|i|t|e|\/|e|s|r|i|\/|a|r|c|g|i|s|-|w|e|b|-|c|o|m|p|o|n|e|n|t|s|-|j|e|s|t|\/|p|a|c|k|a|g|e|s|\/|s|u|p|p|o|r|t|-|p|a|c|k|a|g|e|s|\/|c|o|m|p|o|n|e|n|t|s|-|c|o|n|t|r|o|l|l|e|r|s|-|s|l|i|m|\/|s|r|c|\/|t|e|s|t|s|\/|t|e|s|t|\|.|s|p|e|c|\|.|t|s/i with tests matching "a$".
That regex looks broken with all those pipes. But the Jest's CLI is called with correct regex, so it's something inside of Jest?
I pushed a minimum reproducible case in this repo - https://github.com/maxpatiiuk/vscode-jest-bug-reproduction
README.md contains reproduction steps
This might have something to do with Yarn, as changing run command from yarn test
to npm run test
resolves the issue
@maxpatiiuk, thanks for the sample repo. I can now reproduce this issue. It seems that the process we spawned was never closed as expected, thus blocking the subsequent test request.
The issue seems to be related to stencil
, not yarn. If I run jest directly (by not setting jest.jestCommandLine), everything worked as expected. Looking at the command line we generated, the culprit seems to be the `"--watchAll=false", stencil interpreted this incorrectly and started the process in watch mode, opposite of what we intended.
You can easily reproduce this by issuing this command in the terminal:
yarn test --listTests --json --watchAll=false
You will see it went into a watch mode. Now compare with running jest directly:
yarn jest --listTests --json --watchAll=false
Directly running jest shows the right behavior. You might want to file a bug report in stencil.
@hkan0157, not sure if you have the same stencil dependency. I noticed your node/npm version is really old. The latest jest doesn't even support those versions anymore... which jest version are you running?
Describe the bug I'm able to run only once in VS Code using Jest extension. In order to test it again, If I run the same test it just loads for long time, nothing happens. I need to close and open each time to run tests. But when I run tests as debug, it is fine. But when we need to run as normal test it doesn't allow.
Environment (please complete the following information):
node -v
: [v14.20.0]npm -v
oryarn --version
: [npm 6.14.17]Prerequisite
The fastest (and the most fun) way to resolve the issue is to submit a pull request yourself. If you are interested, please check out the contribution guide, we look forward to seeing your PR...