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: 47c60558ec/src/configuration.ts (L405-L411)
This commit is contained in:
Koen Vlaswinkel
2022-11-25 10:41:22 +01:00
parent e55b8a366e
commit 4be69e858c
2 changed files with 7 additions and 12 deletions

15
.vscode/launch.json vendored
View File

@@ -72,13 +72,10 @@
"--projects", "--projects",
"out/vscode-tests/no-workspace" "out/vscode-tests/no-workspace"
], ],
"stopOnEntry": false,
"sourceMaps": true, "sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
}, },
{ {
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)", "name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
@@ -91,13 +88,10 @@
"--projects", "--projects",
"out/vscode-tests/minimal-workspace" "out/vscode-tests/minimal-workspace"
], ],
"stopOnEntry": false,
"sourceMaps": true, "sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
}, },
{ {
"name": "Launch Integration Tests - With CLI", "name": "Launch Integration Tests - With CLI",
@@ -128,13 +122,10 @@
// available in the workspace for the tests. // available in the workspace for the tests.
// "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql", // "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql",
}, },
"stopOnEntry": false,
"sourceMaps": true, "sourceMaps": true,
"outFiles": [
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
],
"console": "integratedTerminal", "console": "integratedTerminal",
"internalConsoleOptions": "neverOpen", "internalConsoleOptions": "neverOpen",
"attachSimplePort": 9223,
}, },
{ {
"name": "Launch Storybook", "name": "Launch Storybook",

View File

@@ -16,4 +16,8 @@ const config: RunnerOptions = {
extensionDevelopmentPath: rootDir, extensionDevelopmentPath: rootDir,
}; };
if (process.env.VSCODE_INSPECTOR_OPTIONS) {
config.launchArgs?.push("--inspect-extensions", "9223");
}
export default config; export default config;