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
+43-14Lines changed: 43 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,29 +91,58 @@ Alternatively, you can start Storybook inside of VSCode. There is a VSCode launc
91
91
92
92
More information about Storybook can be found inside the **Overview** page once you have launched Storybook.
93
93
94
-
### Running the unit tests and integration tests that do not require a CLI instance
94
+
### Testing
95
95
96
-
Unit tests and many integration tests do not require a copy of the CodeQL CLI.
96
+
We have several types of tests:
97
97
98
-
Outside of vscode, in the `extensions/ql-vscode` directory, run:
98
+
* Unit tests: these live in the `tests/pure-tests/` directory
99
+
* View tests: these live in `src/view/variant-analysis/__tests__/`
100
+
* VSCode integration tests: these live in `src/vscode-tests/no-workspace` and `src/vscode-tests/minimal-workspace`
101
+
* CLI integration tests: these live in `src/vscode-tests/cli-integration`
102
+
103
+
The CLI integration tests require an instance of the CodeQL CLI to run so they will require some extra setup steps. When adding new tests to our test suite, please be mindful of whether they need to be in the cli-integration folder. If the tests don't depend on the CLI, they are better suited to being a VSCode integration test.
104
+
105
+
#### Running the tests
106
+
107
+
##### 1. From the terminal
108
+
109
+
First move into the `extensions/ql-vscode` directory. Then, depending on which tests you want to run, use the appropriate command to run the tests:
110
+
111
+
* Unit tests: `npm run test:unit`
112
+
* View Tests: `npm test:view`
113
+
* VSCode integration tests: `npm run integration`
114
+
115
+
###### CLI integration tests
116
+
117
+
The CLI integration tests require the CodeQL standard libraries in order to run so you will need to clone a local copy of the `github/codeql` repository.
118
+
119
+
1. Set the `TEST_CODEQL_PATH` environment variable: running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
120
+
121
+
2. Run your test command:
99
122
100
123
```shell
101
-
npm run test&& npm run integration
124
+
cd extensions/ql-vscode && npm run cli-integration
102
125
```
103
126
104
-
Alternatively, you can run the tests inside of vscode. There are several vscode launch configurations defined that run the unit and integration tests. They can all be found in the debug view.
127
+
##### 2. From VSCode
105
128
106
-
Only the _With CLI_tests require a CLI instance to run. See below on how to do that.
129
+
Alternatively, you can run the tests inside of VSCode. There are several VSCode launch configurations defined that run the unit and integration tests.
107
130
108
-
Running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
131
+
You will need to run tests using a task from inside of VS Code, under the "Run and Debug" view:
109
132
110
-
### Running the integration tests
133
+
* Unit tests: run the _Launch Unit Tests - React_ task
134
+
* View Tests: run the _Launch Unit Tests_ task
135
+
* VSCode integration tests: run the _Launch Unit Tests - No Workspace_ and _Launch Unit Tests - Minimal Workspace_ tasks
111
136
112
-
You will need to run CLI tests using a task from inside of VS Code called _Launch Integration Tests - With CLI_.
137
+
###### CLI integration tests
113
138
114
139
The CLI integration tests require the CodeQL standard libraries in order to run so you will need to clone a local copy of the `github/codeql` repository.
115
140
116
-
From inside of VSCode, open the `launch.json` file and in the _Launch Integration Tests - With CLI_ task, uncomment the `"${workspaceRoot}/../codeql"` line. If necessary, replace value with a path to your checkout, and then run the task.
141
+
1. Set the `TEST_CODEQL_PATH` environment variable: running from a terminal, you _must_ set the `TEST_CODEQL_PATH` variable to point to a checkout of the `github/codeql` repository. The appropriate CLI version will be downloaded as part of the test.
142
+
143
+
2. Set the codeql path in VSCode's launch configuration: open `launch.json` and under the _Launch Integration Tests - With CLI_ section, uncomment the `"${workspaceRoot}/../codeql"` line. If you've cloned the `github/codeql` repo to a different path, replace the value with the correct path.
144
+
145
+
3. Run the VSCode task from the "Run and Debug" view called _Launch Integration Tests - With CLI_.
117
146
118
147
## Releasing (write access required)
119
148
@@ -137,7 +166,7 @@ From inside of VSCode, open the `launch.json` file and in the _Launch Integratio
137
166
git tag v1.3.6
138
167
```
139
168
140
-
If you've accidentally created a badly named tag, you can delete it via
169
+
If you've accidentally created a badly named tag, you can delete it via
141
170
```bash
142
171
git tag -d badly-named-tag
143
172
```
@@ -148,13 +177,13 @@ From inside of VSCode, open the `launch.json` file and in the _Launch Integratio
148
177
```bash
149
178
git push upstream refs/tags/v1.3.6
150
179
```
151
-
180
+
152
181
b. If you're working straight in this repo:
153
182
154
183
```bash
155
184
git push origin refs/tags/v1.3.6
156
-
```
157
-
185
+
```
186
+
158
187
This will trigger [a release build](https://github.com/github/vscode-codeql/releases) on Actions.
159
188
160
189
* **IMPORTANT** Make sure you are on the `main` branch and your local checkout is fully updated when you add the tag.
0 commit comments