From 7a78ec0a5441a2a28d6a7af7dbaff21a4321e006 Mon Sep 17 00:00:00 2001 From: Sam Partington Date: Tue, 14 Jul 2020 09:49:21 +0100 Subject: [PATCH] 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. --- .vscode/launch.json | 25 +++++++++++++++++++++++++ CONTRIBUTING.md | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..79da9b2121 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug AVA test file", + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava", + "runtimeArgs": [ + "${file}", + "--break", + "--serial", + "--timeout=20m" + ], + "port": 9229, + "outputCapture": "std", + "skipFiles": [ + "/**/*.js" + ] + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8bc3efb315..f3aadf61e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,6 +20,8 @@ Before you start, ensure that you have a recent version of node installed. You c * Run tests: `npm run test`. You’ll need to ensure that the JavaScript files are up-to-date first by running the command above. * Run the linter: `npm run lint`. +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. + ### Running the action 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.