docs: document debugging a Node test in VSCode/Bazel (#21868)

PR Close #21868
This commit is contained in:
Victor Berchet 2018-01-29 12:08:25 -08:00 committed by Jason Aden
parent dd48df105b
commit 11b12670b2
1 changed files with 39 additions and 1 deletions

View File

@ -68,6 +68,44 @@ keeps the outputs up-to-date as you save sources.
The process should automatically connect to the debugger. The process should automatically connect to the debugger.
### Debugging a Node Test in VSCode
First time setup:
- Go to Debug > Add configuration (in the menu bar) to open `launch.json`
- Add the following to the `configurations` array:
```
{
"name": "Attach (inspect)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
{
"name": "Attach (no-sm,inspect)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
},
```
The easiest way to debug a test for now is to add a `debugger` statement in the code
and launch the bazel corresponding test (`bazel test <target> --config=debug`).
Bazel will wait on a connection. Go to the debug view (by clicking on the sidebar or
Apple+Shift+D on Mac) and click on the green play icon next to the configuration name
(ie `Attach (inspect)`).
### Debugging a Karma Test ### Debugging a Karma Test
- Run test: `bazel run packages/core/test:test_web` - Run test: `bazel run packages/core/test:test_web`