Skip to content

Commit 4be69e8

Browse files
committed
Add debugging support for Jest integration tests
Since we are launching a completely different process for the extension tests than the process that is launched by VSCode, we need to add some special handling for the debugging. This will let the extension host/VSCode expose a debugging port, which VSCode will then connect to. This is "less desirable than letting the bootloader do its thing", but a packaged VSCode application does not allow using the bootloader (`NODE_OPTIONS`=`--require=...`). Therefore, we have to fallback to this option. See: https://github.com/microsoft/vscode-js-debug/blob/47c60558ec31902f42c255abb9b460078df02f9d/src/configuration.ts#L405-L411
1 parent e55b8a3 commit 4be69e8

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

.vscode/launch.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,10 @@
7272
"--projects",
7373
"out/vscode-tests/no-workspace"
7474
],
75-
"stopOnEntry": false,
7675
"sourceMaps": true,
77-
"outFiles": [
78-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
79-
],
8076
"console": "integratedTerminal",
8177
"internalConsoleOptions": "neverOpen",
78+
"attachSimplePort": 9223,
8279
},
8380
{
8481
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
@@ -91,13 +88,10 @@
9188
"--projects",
9289
"out/vscode-tests/minimal-workspace"
9390
],
94-
"stopOnEntry": false,
9591
"sourceMaps": true,
96-
"outFiles": [
97-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
98-
],
9992
"console": "integratedTerminal",
10093
"internalConsoleOptions": "neverOpen",
94+
"attachSimplePort": 9223,
10195
},
10296
{
10397
"name": "Launch Integration Tests - With CLI",
@@ -128,13 +122,10 @@
128122
// available in the workspace for the tests.
129123
// "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql",
130124
},
131-
"stopOnEntry": false,
132125
"sourceMaps": true,
133-
"outFiles": [
134-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
135-
],
136126
"console": "integratedTerminal",
137127
"internalConsoleOptions": "neverOpen",
128+
"attachSimplePort": 9223,
138129
},
139130
{
140131
"name": "Launch Storybook",

extensions/ql-vscode/src/vscode-tests/jest-runner-vscode.config.base.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ const config: RunnerOptions = {
1616
extensionDevelopmentPath: rootDir,
1717
};
1818

19+
if (process.env.VSCODE_INSPECTOR_OPTIONS) {
20+
config.launchArgs?.push("--inspect-extensions", "9223");
21+
}
22+
1923
export default config;

0 commit comments

Comments
 (0)