Skip to content

Commit 61e0d05

Browse files
authored
Fix VSCode debugging instructions
`configurations` is an array, not an object. Add instructions for debugging precompiled tests.
1 parent 630aac3 commit 61e0d05

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

docs/recipes/debugging-with-vscode.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can debug your tests using [Visual Studio Code](https://code.visualstudio.co
1212
1. In the sidebar click the *Debug* handle.
1313
1. Create a `launch.json` file.
1414
1. Select the Node.js environment.
15-
1. Add following to the `configurations` object:
15+
1. Add following to the `configurations` array and save changes:
1616

1717
```json
1818
{
@@ -32,14 +32,39 @@ You can debug your tests using [Visual Studio Code](https://code.visualstudio.co
3232
]
3333
}
3434
```
35-
1. Save your changes to the `launch.json` file.
3635

3736
## Using the debugger
3837

3938
Open the file(s) you want to debug. You can set breakpoints or use the `debugger` keyword.
4039

4140
Now, *with a test file open*, from the *Debug* menu run the *Debug AVA test file* configuration.
4241

42+
## Debugging precompiled tests
43+
44+
If you compile your test files into a different directory, and run the tests *from* that directory, the above configuration won't work.
45+
46+
Assuming the names of your test files are unique you could try the following configuration instead. This assumes the compile output is written to the `build` directory. Adjust as appropriate:
47+
48+
49+
```json
50+
{
51+
"type": "node",
52+
"request": "launch",
53+
"name": "Debug AVA test file",
54+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
55+
"runtimeArgs": [
56+
"debug",
57+
"--break",
58+
"build/**/${fileBasenameNoExtension}.*"
59+
],
60+
"port": 9229,
61+
"outputCapture": "std",
62+
"skipFiles": [
63+
"<node_internals>/**/*.js"
64+
]
65+
}
66+
```
67+
4368
## Serial debugging
4469

4570
By default AVA runs tests concurrently. This may complicate debugging. Add a configuration with the `--serial` argument so AVA runs only one test at a time:

0 commit comments

Comments
 (0)