Skip to content

Commit 7a78ec0

Browse files
committed
Add support for debugging from VSCode
https://github.com/avajs/ava/blob/master/docs/recipes/debugging-with-vscode.md recommends passing the `debug` option to Ava. However, in my experience Ava waits indefinitely when this option is used, without actually running any tests. The increased timeout setting is so that tests won't fail prematurely because you're slowly stepping through code.
1 parent c3dcf26 commit 7a78ec0

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.vscode/launch.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Debug AVA test file",
11+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
12+
"runtimeArgs": [
13+
"${file}",
14+
"--break",
15+
"--serial",
16+
"--timeout=20m"
17+
],
18+
"port": 9229,
19+
"outputCapture": "std",
20+
"skipFiles": [
21+
"<node_internals>/**/*.js"
22+
]
23+
}
24+
]
25+
}

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Before you start, ensure that you have a recent version of node installed. You c
2020
* Run tests: `npm run test`. You’ll need to ensure that the JavaScript files are up-to-date first by running the command above.
2121
* Run the linter: `npm run lint`.
2222

23+
This project also includes configuration to run tests from VSCode (with support for breakpoints) - open the test file you wish to run and choose "Debug AVA test file" from the Run menu in the Run panel.
24+
2325
### Running the action
2426

2527
To see the effect of your changes and to test them, push your changes in a branch and then look at the [Actions output](https://github.com/github/codeql-action/actions) for that branch. You can also exercise the code locally by running the automated tests.

0 commit comments

Comments
 (0)