Jest "No tests found" after update VSCode to 1.32.1
After install old version VSCode (1.30.2), I saw the output:
Test Suites: 1 passed, 1 total
Tests: 9 passed, 9 total
Snapshots: 0 total
Time: 4.866s
Ran all test suites matching /src\\utils\\storage\\my-file-name.test.js/i.
Waiting for the debugger to disconnect...
Difference is Pattern
:
- v1.30.2:
/src\\utils\\storage\\my-file-name.test.js/i.
- v1.32.1:
src\utils\storage\my-file-name.test.js
VSCode change their ${relativeFile}
's seperator from \\
to \
, this is why jest
couldn't find out test file
For those who are being stuck, just change "${relativeFile}"
to "${fileBasenameNoExtension}"
in launch.json
configuration:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"./${fileBasename}"
],
"env": {
"cross-env": "1",
"NODE_PATH": "./src",
"__PLATFORM__": " WEB",
},
"runtimeArgs": [
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}