From 1fc2003e2552cf48a7997f94e0c71995e825dfde Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Tue, 14 Jun 2022 15:09:20 -0700 Subject: [PATCH] BYO remote server for web tests (#10457) --- .vscode/launch.json | 2 +- .vscode/tasks.json | 3 ++- build/preDebugWebTest.js | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3c0a1ab0703..f2189783142 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -111,7 +111,7 @@ ], "outFiles": ["${workspaceFolder}/out/**/*.*"], "sourceMaps": true, - "preLaunchTask": "Start Jupyter Server", + "preLaunchTask": "Start Jupyter Server", // Update the env variables for this script in tasks.json with a remote URI to use your own "postDebugTask": "Stop Jupyter Server", "presentation": { "group": "2_tests", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 90206b5d005..91c203337fb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -87,7 +87,8 @@ "problemMatcher": [], "options": { "env": { - "CI_PYTHON_PATH": "" // Update with path to real python interpereter used for testing. + "CI_PYTHON_PATH": "", // Update with path to real python interpereter used for testing. + "EXISTING_JUPYTER_URI": "", // Update with a server that you started yourself to avoid this script doing it } } }, diff --git a/build/preDebugWebTest.js b/build/preDebugWebTest.js index e164863f367..9ff726996c8 100644 --- a/build/preDebugWebTest.js +++ b/build/preDebugWebTest.js @@ -8,8 +8,13 @@ const jsonc = require('jsonc-parser'); const settingsFile = path.join(__dirname, '..', 'src', 'test', 'datascience', '.vscode', 'settings.json'); async function go() { - const { server, url } = await startJupyter(true); - fs.writeFileSync(path.join(__dirname, '..', 'temp', 'jupyter.pid'), server.pid.toString()); + let url = process.env.EXISTING_JUPYTER_URI; + if (!url) { + const { server, url } = await startJupyter(true); + fs.writeFileSync(path.join(__dirname, '..', 'temp', 'jupyter.pid'), server.pid.toString()); + } else { + console.log('Jupyter server URL provided in env args, no need to start one'); + } const settingsJson = fs.readFileSync(settingsFile).toString(); const edits = jsonc.modify(settingsJson, ['jupyter.DEBUG_JUPYTER_SERVER_URI'], url, {}); const updatedSettingsJson = jsonc.applyEdits(settingsJson, edits);