From 3c0891b401d63afeb0c4a2bc6dad6ed9bb10df30 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 2 Feb 2022 10:46:29 -0800 Subject: [PATCH 1/2] add some example launch.jsons --- systems/debugging/settings.md | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 systems/debugging/settings.md diff --git a/systems/debugging/settings.md b/systems/debugging/settings.md new file mode 100644 index 0000000..e1ce89b --- /dev/null +++ b/systems/debugging/settings.md @@ -0,0 +1,80 @@ +Here are some settings that sandersn uses + +## Hard-coded file: + +This starts much faster than a full test run. I update the compiler flags each time I debug something new. + + { + "name": "welove.ts", + "program": "${workspaceRoot}/built/local/tsc.js", + "request": "launch", + "skipFiles": [ + "/**" + ], + "sourceMaps": true, + "smartStep": true, + "args": ["--noEmit", "--skipLibCheck", "--strict", "--exactOptionalPropertyTypes", "/home/nathansa/src/test/welove.ts"], + "env": { + "NODE_ENV": "testing" + }, + "type": "pwa-node", + "console": "integratedTerminal", + "outFiles": [ "${workspaceRoot}/built/local/tsc.js"] + }, + +I also have a Javascript and JSX target that are nearly identical. + +## Currently opened test + +This debugs the current test file that's open in VS Code. + + { + "type": "pwa-node", + "protocol": "inspector", + "request": "launch", + "name": "Mocha Tests (currently opened test)", + "runtimeArgs": ["--nolazy"], + "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", + "args": [ + "-u", + "bdd", + "--no-timeouts", + "--colors", + "built/local/run.js", + "-f", + // You can change this to be the name of a specific test file (without the file extension) + // to consistently launch the same test + "${fileBasenameNoExtension}", + ], + "env": { + "NODE_ENV": "testing" + }, + "sourceMaps": true, + "smartStep": true, + "preLaunchTask": "gulp: tests", + "console": "integratedTerminal", + "outFiles": [ + "${workspaceRoot}/built/local/run.js" + ] + }, + +I also made a hard-coded variant, as suggested by the comment. + +## Attach to running tsc + +This is sometimes useful when I want to build a complex project with `tsc -b` and then debug it. + + { + "name": "9229", + "port": 9229, + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node", + "env": { + "NODE_ENV": "testing" + }, + "sourceMaps": true, + "outFiles": [ "${workspaceRoot}/built/local/tsc.js"] + }, From 0feac01ba38e7aba8fb6a4a148c0769e51275699 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 2 Feb 2022 10:46:54 -0800 Subject: [PATCH 2/2] better intro line --- systems/debugging/settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systems/debugging/settings.md b/systems/debugging/settings.md index e1ce89b..889ed36 100644 --- a/systems/debugging/settings.md +++ b/systems/debugging/settings.md @@ -1,4 +1,4 @@ -Here are some settings that sandersn uses +Here are some launch.json configurations that sandersn uses ## Hard-coded file: