Skip to content

Commit 301fd86

Browse files
authored
fix: VSCode Jest debugging (#28388)
1 parent 03b9582 commit 301fd86

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

.vscode/launch.json

+23-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"request": "launch",
3232
"name": "Jest Current File",
3333
"runtimeExecutable": "pnpm",
34-
"program": "jest:vscode",
34+
"program": "jest",
3535
"args": [
3636
"--runInBand",
3737
"--collectCoverage=false",
@@ -52,7 +52,7 @@
5252
"request": "launch",
5353
"name": "Jest All",
5454
"runtimeExecutable": "pnpm",
55-
"program": "jest:vscode",
55+
"program": "jest",
5656
"args": [
5757
"--runInBand",
5858
"--collectCoverage=false",
@@ -71,7 +71,7 @@
7171
"request": "launch",
7272
"name": "Jest Current Folder",
7373
"runtimeExecutable": "pnpm",
74-
"program": "jest:vscode",
74+
"program": "jest",
7575
"args": [
7676
"--runInBand",
7777
"--collectCoverage=false",
@@ -84,14 +84,29 @@
8484
},
8585
{
8686
"type": "node",
87-
"name": "vscode-jest-tests",
87+
"name": "vscode-jest-tests.v2",
8888
"request": "launch",
8989
"console": "integratedTerminal",
90-
"internalConsoleOptions": "neverOpen",
90+
"internalConsoleOptions": "openOnSessionStart",
9191
"cwd": "${workspaceFolder}",
92-
"runtimeExecutable": "pnpm",
93-
"program": "jest:vscode",
94-
"args": ["--runInBand", "--watchAll=false", "--testTimeout=100000000"]
92+
"runtimeExecutable": "node",
93+
"runtimeArgs": ["--experimental-vm-modules"],
94+
"program": "node_modules/jest/bin/jest.js",
95+
"args": [
96+
"--runInBand",
97+
"--watchAll=false",
98+
"--testTimeout=100000000",
99+
"--coverage=false",
100+
"--runTestsByPath",
101+
"${jest.testFile}",
102+
"--testNamePattern",
103+
"${jest.testNamePattern}"
104+
],
105+
"env": {
106+
"NODE_ENV": "test",
107+
"LOG_LEVEL": "trace",
108+
"GIT_ALLOW_PROTOCOL": "file"
109+
}
95110
}
96111
]
97112
}

.vscode/settings.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
".releaserc": "json"
1717
},
1818
"omnisharp.autoStart": false,
19-
"jest.autoRun": "off",
20-
"jest.jestCommandLine": "pnpm jest",
19+
"jest.runMode": "on-demand",
20+
"jest.jestCommandLine": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
21+
"jest.nodeEnv": {
22+
"NODE_ENV": "test",
23+
"LOG_LEVEL": "trace",
24+
"GIT_ALLOW_PROTOCOL": "file"
25+
},
2126
"npm.packageManager": "pnpm",
2227
"editor.formatOnSave": true,
2328
"editor.codeActionsOnSave": {

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
"generate:imports": "node tools/generate-imports.mjs",
2929
"git-check": "node tools/check-git-version.mjs",
3030
"jest": "node tools/jest.mjs",
31-
"jest:vscode": "node tools/jest.mjs",
32-
"jest-debug": "NODE_OPTIONS='$NODE_OPTIONS --inspect-brk' node tools/jest.mjs --testTimeout=100000000",
3331
"lint": "run-s ls-lint type-check eslint prettier markdown-lint git-check doc-fence-check",
3432
"lint-fix": "run-s eslint-fix prettier-fix markdown-lint-fix",
3533
"ls-lint": "ls-lint",

0 commit comments

Comments
 (0)