|
| 1 | +Here are some launch.json configurations that sandersn uses |
| 2 | + |
| 3 | +## Hard-coded file: |
| 4 | + |
| 5 | +This starts much faster than a full test run. I update the compiler flags each time I debug something new. |
| 6 | + |
| 7 | + { |
| 8 | + "name": "welove.ts", |
| 9 | + "program": "${workspaceRoot}/built/local/tsc.js", |
| 10 | + "request": "launch", |
| 11 | + "skipFiles": [ |
| 12 | + "<node_internals>/**" |
| 13 | + ], |
| 14 | + "sourceMaps": true, |
| 15 | + "smartStep": true, |
| 16 | + "args": ["--noEmit", "--skipLibCheck", "--strict", "--exactOptionalPropertyTypes", "/home/nathansa/src/test/welove.ts"], |
| 17 | + "env": { |
| 18 | + "NODE_ENV": "testing" |
| 19 | + }, |
| 20 | + "type": "pwa-node", |
| 21 | + "console": "integratedTerminal", |
| 22 | + "outFiles": [ "${workspaceRoot}/built/local/tsc.js"] |
| 23 | + }, |
| 24 | + |
| 25 | +I also have a Javascript and JSX target that are nearly identical. |
| 26 | + |
| 27 | +## Currently opened test |
| 28 | + |
| 29 | +This debugs the current test file that's open in VS Code. |
| 30 | + |
| 31 | + { |
| 32 | + "type": "pwa-node", |
| 33 | + "protocol": "inspector", |
| 34 | + "request": "launch", |
| 35 | + "name": "Mocha Tests (currently opened test)", |
| 36 | + "runtimeArgs": ["--nolazy"], |
| 37 | + "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", |
| 38 | + "args": [ |
| 39 | + "-u", |
| 40 | + "bdd", |
| 41 | + "--no-timeouts", |
| 42 | + "--colors", |
| 43 | + "built/local/run.js", |
| 44 | + "-f", |
| 45 | + // You can change this to be the name of a specific test file (without the file extension) |
| 46 | + // to consistently launch the same test |
| 47 | + "${fileBasenameNoExtension}", |
| 48 | + ], |
| 49 | + "env": { |
| 50 | + "NODE_ENV": "testing" |
| 51 | + }, |
| 52 | + "sourceMaps": true, |
| 53 | + "smartStep": true, |
| 54 | + "preLaunchTask": "gulp: tests", |
| 55 | + "console": "integratedTerminal", |
| 56 | + "outFiles": [ |
| 57 | + "${workspaceRoot}/built/local/run.js" |
| 58 | + ] |
| 59 | + }, |
| 60 | + |
| 61 | +I also made a hard-coded variant, as suggested by the comment. |
| 62 | + |
| 63 | +## Attach to running tsc |
| 64 | + |
| 65 | +This is sometimes useful when I want to build a complex project with `tsc -b` and then debug it. |
| 66 | + |
| 67 | + { |
| 68 | + "name": "9229", |
| 69 | + "port": 9229, |
| 70 | + "request": "attach", |
| 71 | + "skipFiles": [ |
| 72 | + "<node_internals>/**" |
| 73 | + ], |
| 74 | + "type": "pwa-node", |
| 75 | + "env": { |
| 76 | + "NODE_ENV": "testing" |
| 77 | + }, |
| 78 | + "sourceMaps": true, |
| 79 | + "outFiles": [ "${workspaceRoot}/built/local/tsc.js"] |
| 80 | + }, |
0 commit comments