From 2e329908cf5badf05561f424393fc9ff351a550c Mon Sep 17 00:00:00 2001 From: Justin Grant Date: Fri, 10 Sep 2021 15:09:16 -0700 Subject: [PATCH] Add VS Code config for IDE debugging of tests This commit adds a launch.json to enable easy IDE debugging of either Demitasse or (coming soon in #41) Test262 tests. For Test262, there are two different configs: 1) Only debug the subset of tests shown in launch.json. Edit launch.json to debug other tests. Warning: commenting out the TESTS env var will debug all tests but that will take 10+ mins to run. 2) Only debug the test file currently open in the editor. --- .gitignore | 3 ++- .npmignore | 1 + .vscode/launch.json | 50 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 211717b7..d7c7c711 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ node_modules/ dist/ tsc-out/ .eslintcache -.vscode/ +.vscode/* +!.vscode/launch.json *.tgz diff --git a/.npmignore b/.npmignore index c5b178a4..77d4e578 100644 --- a/.npmignore +++ b/.npmignore @@ -3,3 +3,4 @@ test types tsconfig.json *.sh +.vscode diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..504a19f3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,50 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Test262 (edit subset in launch.json)", + "request": "launch", + "type": "node", + "runtimeExecutable": "npm", + "runtimeArgs": ["run", "test262"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "autoAttachChildProcesses": true, + "env": { + // Replace the glob pattern below with tests you want to debug. + // Comment out to run all tests, but will be very slow! + "TESTS": "PlainYearMonth/prototype/subtract/*.js", + // Extends timeouts to 1 hour (from 10 seconds default) so you can + // debug a test stopped at a breakpoint before the runner kills it. + "TIMEOUT": "3600000" + } + }, + { + "name": "Test262 (current file)", + "request": "launch", + "type": "node", + "runtimeExecutable": "npm", + "runtimeArgs": ["run", "test262"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "autoAttachChildProcesses": true, + "env": { + // Only test the currently-opened file in the IDE + "TESTS": "${file}", + // Extends timeouts to 1 hour (from 10 seconds default) so you can + // debug a test stopped at a breakpoint before the runner kills it. + "TIMEOUT": "3600000" + } + }, + { + "name": "Demitasse tests", + "request": "launch", + "type": "node", + "runtimeExecutable": "npm", + "runtimeArgs": ["test"], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "autoAttachChildProcesses": true, + }, + ] +}