You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,32 @@ The CLI integration tests require the CodeQL standard libraries in order to run
150
150
151
151
3. Run the VSCode task from the "Run and Debug" view called _Launch Integration Tests - With CLI_.
152
152
153
+
#### Running a single test
154
+
155
+
##### 1. From the terminal
156
+
157
+
The easiest way to run a single test is to change the `it` of the test to `it.only` and then run the test command with some additional options
158
+
to only run tests for this specific file. For example, to run the test `src/vscode-tests/cli-integration/run-queries.test.ts`:
159
+
160
+
```shell
161
+
npm run cli-integration -- --runTestsByPath src/vscode-tests/cli-integration/run-queries.test.ts
162
+
```
163
+
164
+
You can also use the `--testNamePattern` option to run a specific test within a file. For example, to run the test `src/vscode-tests/cli-integration/run-queries.test.ts`:
165
+
166
+
```shell
167
+
npm run cli-integration -- --runTestsByPath src/vscode-tests/cli-integration/run-queries.test.ts --testNamePattern "should create a QueryEvaluationInfo"
168
+
```
169
+
170
+
##### 2. From VSCode
171
+
172
+
Alternatively, you can run a single test inside VSCode. To do so, install the [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) extension. Then,
173
+
you will have quicklinks to run a single test from within test files. To run a single unit or integration test, click the "Run" button. Debugging a single test is currently only supported
174
+
for unit tests by default. To debug integration tests, open the `.vscode/settings.json` file and uncomment the `jestrunner.debugOptions` lines. This will allow you to debug integration tests.
175
+
Please make sure to revert this change before committing; with this setting enabled, it is not possible to debug unit tests.
176
+
177
+
Without the Jest Runner extension, you can also use the "Launch Selected Unit Test (vscode-codeql)" launch configuration to run a single unit test.
178
+
153
179
#### Using a mock GitHub API server
154
180
155
181
Multi-Repo Variant Analyses (MRVA) rely on the GitHub API. In order to make development and testing easy, we have functionality that allows us to intercept requests to the GitHub API and provide mock responses.
0 commit comments