Skip to content

Commit

Permalink
🔧 Add launch configuration to run tests with VSCode debugger (#1176)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAfroOfDoom authored May 19, 2024
1 parent bfa9854 commit 6242127
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
* text=auto eol=lf
/__snapshots__/** linguist-generated=true
/contributors/* linguist-generated=true
/README.md linguist-generated=true
/**/*.generated.* linguist-generated=true
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@
"restart": true,
"timeout": 180000,
"outFiles": ["${workspaceRoot}/packages/vscode-extension/dist/**/*.js"]
},
{
"type": "node",
"request": "launch",
"name": "Run Unit Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
],
"compounds": [
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you're using VS Code to develop Spyglass:
- Install the recommended [ESLint extension][eslint-extension]. Make a copy of `.vscode/settings.template.json` and rename it to `.vscode/settings.json`.
Now your VS Code should automatically fix all linting errors every time you save the file.
- Press F5 to run the VS Code extension in development environment. VS Code will automatically compile all packages and build the extension file in watch mode.
- Press F5 to run the VS Code extension in development environment (`Launch Client`). VS Code will automatically compile all packages and build the extension file in watch mode.
Or if you prefer the command line interface:
Expand All @@ -49,6 +49,8 @@ Or if you prefer the command line interface:

Please refrain from using `mocha --watch`, as it might interface with and break the snapshot testing.

You can debug tests with breakpoints by running the `Run Unit Tests` configuration and setting your breakpoints accordingly. If you want to run a specific subset of tests, add `.only` after the test block (e.g. `describe.only()`, `it.only()`).
### Code style
Tabs for indents, spaces for alignment. Except do not align things because the available tooling is unfortunately terrible.
Expand Down

0 comments on commit 6242127

Please sign in to comment.