From 1d041531900f88fede3d006730efb40f8f7dae07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Peer=20St=C3=B6cklmair?= Date: Sat, 6 May 2017 10:12:03 +0200 Subject: [PATCH] Add recipe on debugging with VSCode (#1375) --- docs/recipes/debugging-with-vscode.md | 31 +++++++++++++++++++++++++++ readme.md | 1 + 2 files changed, 32 insertions(+) create mode 100644 docs/recipes/debugging-with-vscode.md diff --git a/docs/recipes/debugging-with-vscode.md b/docs/recipes/debugging-with-vscode.md new file mode 100644 index 000000000..432ae7c69 --- /dev/null +++ b/docs/recipes/debugging-with-vscode.md @@ -0,0 +1,31 @@ +# Debugging tests with Visual Studio Code + +## Setup + +In the sidebar click the `Debug` handle. + +Add a new configuration in the dropdown menu next to the green `Debug` button: `Add configuration`. This will open `launch.json` with all debug configurations. + +Add following to the `configurations` object: + +```json +{ + "type": "node", + "request": "launch", + "name": "Run AVA test", + "program": "${workspaceRoot}/node_modules/ava/profile.js", + "args": [ + "${file}" + ] +} +``` + +Save this configuration after you added it. + +## Debug + +> **Note:** The file you want to debug, must be open and active + +Set breakpoints in the code. + +Hit the green `Debug` button next to the list of configurations on the top left in the `Debug` view. Once the breakpoint is hit, you can evaluate variables and step through the code. diff --git a/readme.md b/readme.md index 0bc5747cc..7e68cc3e9 100644 --- a/readme.md +++ b/readme.md @@ -203,6 +203,7 @@ $ node --inspect node_modules/ava/profile.js some/test/file.js - [Chrome DevTools](docs/recipes/debugging-with-chrome-devtools.md) - [WebStorm](docs/recipes/debugging-with-webstorm.md) +- [Visual Studio Code](docs/recipes/debugging-with-vscode.md) ## Reporters