Skip to content

Commit bf328d5

Browse files
committed
Merge remote-tracking branch 'origin/main' into koesie10/stop-monitor-after-remove
2 parents 0047186 + 125867d commit bf328d5

151 files changed

Lines changed: 7574 additions & 5444 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ jobs:
186186
matrix:
187187
os: [ubuntu-latest, windows-latest]
188188
version: ['v2.7.6', 'v2.8.5', 'v2.9.4', 'v2.10.5', 'v2.11.4', 'nightly']
189+
fail-fast: false
189190
env:
190191
CLI_VERSION: ${{ matrix.version }}
191192
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"amodio.tsl-problem-matcher",
77
"dbaeumer.vscode-eslint",
88
"esbenp.prettier-vscode",
9+
"firsttris.vscode-jest-runner",
910
"Orta.vscode-jest",
1011
],
1112
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.

.vscode/launch.json

Lines changed: 56 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@
4545
"console": "integratedTerminal",
4646
"internalConsoleOptions": "neverOpen"
4747
},
48+
{
49+
"name": "Launch Selected Unit Test (vscode-codeql)",
50+
"type": "node",
51+
"request": "launch",
52+
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
53+
"showAsyncStacks": true,
54+
"cwd": "${workspaceFolder}/extensions/ql-vscode",
55+
"env": {
56+
"LANG": "en-US",
57+
"TZ": "UTC"
58+
},
59+
"args": [
60+
"--projects",
61+
"test",
62+
"-i",
63+
"${relativeFile}",
64+
"-t",
65+
"${selectedText}"
66+
],
67+
"stopOnEntry": false,
68+
"sourceMaps": true,
69+
"console": "integratedTerminal",
70+
"internalConsoleOptions": "neverOpen"
71+
},
4872
{
4973
"name": "Launch Unit Tests - React (vscode-codeql)",
5074
"type": "node",
@@ -63,60 +87,46 @@
6387
},
6488
{
6589
"name": "Launch Integration Tests - No Workspace (vscode-codeql)",
66-
"type": "extensionHost",
90+
"type": "node",
6791
"request": "launch",
68-
"runtimeExecutable": "${execPath}",
92+
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
93+
"showAsyncStacks": true,
94+
"cwd": "${workspaceFolder}/extensions/ql-vscode",
6995
"args": [
70-
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
71-
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/no-workspace/index",
72-
"--disable-workspace-trust",
73-
"--disable-extensions",
74-
"--disable-gpu"
96+
"--projects",
97+
"out/vscode-tests/no-workspace"
7598
],
7699
"sourceMaps": true,
77-
"outFiles": [
78-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
79-
],
100+
"console": "integratedTerminal",
101+
"internalConsoleOptions": "neverOpen",
102+
"attachSimplePort": 9223,
80103
},
81104
{
82105
"name": "Launch Integration Tests - Minimal Workspace (vscode-codeql)",
83-
"type": "extensionHost",
106+
"type": "node",
84107
"request": "launch",
85-
"runtimeExecutable": "${execPath}",
108+
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
109+
"showAsyncStacks": true,
110+
"cwd": "${workspaceFolder}/extensions/ql-vscode",
86111
"args": [
87-
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
88-
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/minimal-workspace/index",
89-
"--disable-workspace-trust",
90-
"--disable-extensions",
91-
"--disable-gpu",
92-
"${workspaceRoot}/extensions/ql-vscode/test/data"
112+
"--projects",
113+
"out/vscode-tests/minimal-workspace"
93114
],
94115
"sourceMaps": true,
95-
"outFiles": [
96-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
97-
],
116+
"console": "integratedTerminal",
117+
"internalConsoleOptions": "neverOpen",
118+
"attachSimplePort": 9223,
98119
},
99120
{
100121
"name": "Launch Integration Tests - With CLI",
101-
"type": "extensionHost",
122+
"type": "node",
102123
"request": "launch",
103-
"runtimeExecutable": "${execPath}",
124+
"program": "${workspaceFolder}/extensions/ql-vscode/node_modules/jest/bin/jest.js",
125+
"showAsyncStacks": true,
126+
"cwd": "${workspaceFolder}/extensions/ql-vscode",
104127
"args": [
105-
"--extensionDevelopmentPath=${workspaceRoot}/extensions/ql-vscode",
106-
"--extensionTestsPath=${workspaceRoot}/extensions/ql-vscode/out/vscode-tests/cli-integration/index",
107-
"--disable-workspace-trust",
108-
"--disable-gpu",
109-
"--disable-extension",
110-
"eamodio.gitlens",
111-
"--disable-extension",
112-
"github.codespaces",
113-
"--disable-extension",
114-
"github.copilot",
115-
"${workspaceRoot}/extensions/ql-vscode/src/vscode-tests/cli-integration/data",
116-
// Uncomment the last line and modify the path to a checked out
117-
// instance of the codeql repository so the libraries are
118-
// available in the workspace for the tests.
119-
// "${workspaceRoot}/../codeql"
128+
"--projects",
129+
"out/vscode-tests/cli-integration"
120130
],
121131
"env": {
122132
// Optionally, set the version to use for the integration tests.
@@ -130,11 +140,16 @@
130140
// If not specified, one will be downloaded automatically.
131141
// This option overrides the CLI_VERSION option.
132142
// "CLI_PATH": "${workspaceRoot}/../semmle-code/target/intree/codeql/codeql",
143+
144+
// Uncomment the last line and modify the path to a checked out
145+
// instance of the codeql repository so the libraries are
146+
// available in the workspace for the tests.
147+
// "TEST_CODEQL_PATH": "${workspaceRoot}/../codeql",
133148
},
134149
"sourceMaps": true,
135-
"outFiles": [
136-
"${workspaceRoot}/extensions/ql-vscode/out/**/*.js",
137-
],
150+
"console": "integratedTerminal",
151+
"internalConsoleOptions": "neverOpen",
152+
"attachSimplePort": 9223,
138153
},
139154
{
140155
"name": "Launch Storybook",

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@
3737
"javascript.preferences.quoteStyle": "single",
3838
"editor.wordWrapColumn": 100,
3939
"jest.rootPath": "./extensions/ql-vscode",
40-
"jest.autoRun": "watch",
40+
"jest.autoRun": "off",
4141
"jest.nodeEnv": {
4242
"LANG": "en-US",
4343
"TZ": "UTC"
4444
},
45+
// Uncomment to debug integration tests
46+
// "jestrunner.debugOptions": {
47+
// "attachSimplePort": 9223,
48+
// "env": {
49+
// "VSCODE_WAIT_FOR_DEBUGGER": "true",
50+
// }
51+
// },
4552
"[typescript]": {
4653
"editor.defaultFormatter": "esbenp.prettier-vscode",
4754
"editor.formatOnSave": true,

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,32 @@ The CLI integration tests require the CodeQL standard libraries in order to run
150150

151151
3. Run the VSCode task from the "Run and Debug" view called _Launch Integration Tests - With CLI_.
152152

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+
153179
#### Using a mock GitHub API server
154180

155181
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.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
export enum VSCodeTheme {
22
Dark = "dark",
33
Light = "light",
4+
LightHighContrast = "light-high-contrast",
5+
DarkHighContrast = "dark-high-contrast",
6+
GitHubLightDefault = "github-light-default",
7+
GitHubDarkDefault = "github-dark-default",
48
}
59

610
export const themeNames: { [key in VSCodeTheme]: string } = {
711
[VSCodeTheme.Dark]: "Dark+",
812
[VSCodeTheme.Light]: "Light+",
13+
[VSCodeTheme.LightHighContrast]: "Light High Contrast",
14+
[VSCodeTheme.DarkHighContrast]: "Dark High Contrast",
15+
[VSCodeTheme.GitHubLightDefault]: "GitHub Light Default",
16+
[VSCodeTheme.GitHubDarkDefault]: "GitHub Dark Default",
917
};

extensions/ql-vscode/.storybook/vscode-theme-addon/withTheme.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ const themeFiles: { [key in VSCodeTheme]: string } = {
1616
// eslint-disable-next-line @typescript-eslint/no-var-requires
1717
require("!file-loader?modules!../../src/stories/vscode-theme-light.css")
1818
.default,
19+
[VSCodeTheme.LightHighContrast]:
20+
// eslint-disable-next-line @typescript-eslint/no-var-requires
21+
require("!file-loader?modules!../../src/stories/vscode-theme-light-high-contrast.css")
22+
.default,
23+
[VSCodeTheme.DarkHighContrast]:
24+
// eslint-disable-next-line @typescript-eslint/no-var-requires
25+
require("!file-loader?modules!../../src/stories/vscode-theme-dark-high-contrast.css")
26+
.default,
27+
[VSCodeTheme.GitHubLightDefault]:
28+
// eslint-disable-next-line @typescript-eslint/no-var-requires
29+
require("!file-loader?modules!../../src/stories/vscode-theme-github-light-default.css")
30+
.default,
31+
[VSCodeTheme.GitHubDarkDefault]:
32+
// eslint-disable-next-line @typescript-eslint/no-var-requires
33+
require("!file-loader?modules!../../src/stories/vscode-theme-github-dark-default.css")
34+
.default,
1935
};
2036

2137
export const withTheme = (

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [UNRELEASED]
44

5+
- Required version of VS Code increased to 1.67.0.
6+
57
## 1.7.6 - 21 November 2022
68

79
- Warn users when their VS Code version is too old to support all features in the vscode-codeql extension. [#1674](https://github.com/github/vscode-codeql/pull/1674)

extensions/ql-vscode/jest.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
* https://jestjs.io/docs/configuration
44
*/
55

6+
/** @type {import('@jest/types').Config.InitialOptions} */
67
module.exports = {
7-
projects: ["<rootDir>/src/view", "<rootDir>/test"],
8+
projects: [
9+
"<rootDir>/src/view",
10+
"<rootDir>/test",
11+
"<rootDir>/src/vscode-tests/cli-integration",
12+
"<rootDir>/src/vscode-tests/no-workspace",
13+
"<rootDir>/src/vscode-tests/minimal-workspace",
14+
],
815
};

0 commit comments

Comments
 (0)