Skip to content

Commit 35d1d8b

Browse files
authored
Move VS Code integration tests to /test directory (#1912)
1 parent a7be6cf commit 35d1d8b

171 files changed

Lines changed: 361 additions & 366 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.

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"cwd": "${workspaceFolder}/extensions/ql-vscode",
9595
"args": [
9696
"--projects",
97-
"src/vscode-tests/no-workspace"
97+
"test/vscode-tests/no-workspace"
9898
],
9999
"sourceMaps": true,
100100
"console": "integratedTerminal",
@@ -110,7 +110,7 @@
110110
"cwd": "${workspaceFolder}/extensions/ql-vscode",
111111
"args": [
112112
"--projects",
113-
"src/vscode-tests/minimal-workspace"
113+
"test/vscode-tests/minimal-workspace"
114114
],
115115
"sourceMaps": true,
116116
"console": "integratedTerminal",
@@ -126,7 +126,7 @@
126126
"cwd": "${workspaceFolder}/extensions/ql-vscode",
127127
"args": [
128128
"--projects",
129-
"src/vscode-tests/cli-integration"
129+
"test/vscode-tests/cli-integration"
130130
],
131131
"env": {
132132
// Optionally, set the version to use for the integration tests.

CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ We have several types of tests:
9797

9898
* Unit tests: these live in the `tests/pure-tests/` directory
9999
* 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`
100+
* VSCode integration tests: these live in `test/vscode-tests/no-workspace` and `test/vscode-tests/minimal-workspace`
101+
* CLI integration tests: these live in `test/vscode-tests/cli-integration`
102102

103103
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.
104104

105-
Any test data you're using (sample projects, config files, etc.) must go in a `src/vscode-tests/*/data` directory. When you run the tests, the test runner will copy the data directory to `out/vscode-tests/*/data`.
105+
Any test data you're using (sample projects, config files, etc.) must go in a `test/vscode-tests/*/data` directory. When you run the tests, the test runner will copy the data directory to `out/vscode-tests/*/data`.
106106

107107
#### Running the tests
108108

@@ -155,16 +155,16 @@ The CLI integration tests require the CodeQL standard libraries in order to run
155155
##### 1. From the terminal
156156

157157
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`:
158+
to only run tests for this specific file. For example, to run the test `test/vscode-tests/cli-integration/run-queries.test.ts`:
159159

160160
```shell
161-
npm run cli-integration -- --runTestsByPath src/vscode-tests/cli-integration/run-queries.test.ts
161+
npm run cli-integration -- --runTestsByPath test/vscode-tests/cli-integration/run-queries.test.ts
162162
```
163163

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`:
164+
You can also use the `--testNamePattern` option to run a specific test within a file. For example, to run the test `test/vscode-tests/cli-integration/run-queries.test.ts`:
165165

166166
```shell
167-
npm run cli-integration -- --runTestsByPath src/vscode-tests/cli-integration/run-queries.test.ts --testNamePattern "should create a QueryEvaluationInfo"
167+
npm run cli-integration -- --runTestsByPath test/vscode-tests/cli-integration/run-queries.test.ts --testNamePattern "should create a QueryEvaluationInfo"
168168
```
169169

170170
##### 2. From VSCode

extensions/ql-vscode/gulpfile.ts/tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ export function copyTestData() {
55
}
66

77
export function watchTestData() {
8-
return watch(["src/vscode-tests/*/data/**/*"], copyTestData);
8+
return watch(["test/vscode-tests/*/data/**/*"], copyTestData);
99
}
1010

1111
function copyNoWorkspaceData() {
12-
return src("src/vscode-tests/no-workspace/data/**/*").pipe(
12+
return src("test/vscode-tests/no-workspace/data/**/*").pipe(
1313
dest("out/vscode-tests/no-workspace/data"),
1414
);
1515
}
1616

1717
function copyCliIntegrationData() {
18-
return src("src/vscode-tests/cli-integration/data/**/*").pipe(
18+
return src("test/vscode-tests/cli-integration/data/**/*").pipe(
1919
dest("out/vscode-tests/cli-integration/data"),
2020
);
2121
}

extensions/ql-vscode/jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module.exports = {
88
projects: [
99
"<rootDir>/src/view",
1010
"<rootDir>/test/unit-tests",
11-
"<rootDir>/src/vscode-tests/cli-integration",
12-
"<rootDir>/src/vscode-tests/no-workspace",
13-
"<rootDir>/src/vscode-tests/minimal-workspace",
11+
"<rootDir>/test/vscode-tests/cli-integration",
12+
"<rootDir>/test/vscode-tests/no-workspace",
13+
"<rootDir>/test/vscode-tests/minimal-workspace",
1414
],
1515
};

extensions/ql-vscode/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,9 +1288,9 @@
12881288
"test:unit": "cross-env TZ=UTC LANG=en-US jest --projects test/unit-tests",
12891289
"test:view": "jest --projects src/view",
12901290
"integration": "npm-run-all integration:*",
1291-
"integration:no-workspace": "jest --projects src/vscode-tests/no-workspace",
1292-
"integration:minimal-workspace": "jest --projects src/vscode-tests/minimal-workspace",
1293-
"cli-integration": "jest --projects src/vscode-tests/cli-integration",
1291+
"integration:no-workspace": "jest --projects test/vscode-tests/no-workspace",
1292+
"integration:minimal-workspace": "jest --projects test/vscode-tests/minimal-workspace",
1293+
"cli-integration": "jest --projects test/vscode-tests/cli-integration",
12941294
"update-vscode": "node ./node_modules/vscode/bin/install",
12951295
"format": "prettier --write **/*.{ts,tsx} && eslint . --ext .ts,.tsx --fix",
12961296
"lint": "eslint . --ext .ts,.tsx --max-warnings=0",

extensions/ql-vscode/src/stories/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"lib": ["ES2021", "dom"],
88
"jsx": "react",
99
"sourceMap": true,
10-
"rootDir": "..",
10+
"rootDir": "../../..",
1111
"strict": true,
1212
"noUnusedLocals": true,
1313
"noImplicitReturns": true,

extensions/ql-vscode/src/stories/variant-analysis/RepoRow.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
AnalysisAlert,
1212
AnalysisRawResults,
1313
} from "../../remote-queries/shared/analysis-result";
14-
import { createMockRepositoryWithMetadata } from "../../vscode-tests/factories/remote-queries/shared/repository";
14+
import { createMockRepositoryWithMetadata } from "../../../test/factories/remote-queries/shared/repository";
1515

1616
import * as analysesResults from "../remote-queries/data/analysesResultsMessage.json";
1717
import * as rawResults from "../remote-queries/data/rawResults.json";

extensions/ql-vscode/src/stories/variant-analysis/VariantAnalysis.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import {
1212
VariantAnalysisScannedRepositoryState,
1313
VariantAnalysisStatus,
1414
} from "../../remote-queries/shared/variant-analysis";
15-
import { createMockVariantAnalysis } from "../../vscode-tests/factories/remote-queries/shared/variant-analysis";
16-
import { createMockRepositoryWithMetadata } from "../../vscode-tests/factories/remote-queries/shared/repository";
15+
import { createMockVariantAnalysis } from "../../../test/factories/remote-queries/shared/variant-analysis";
16+
import { createMockRepositoryWithMetadata } from "../../../test/factories/remote-queries/shared/repository";
1717

1818
export default {
1919
title: "Variant Analysis/Variant Analysis",

extensions/ql-vscode/src/stories/variant-analysis/VariantAnalysisAnalyzedRepos.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import {
1212
VariantAnalysisStatus,
1313
} from "../../remote-queries/shared/variant-analysis";
1414
import { AnalysisAlert } from "../../remote-queries/shared/analysis-result";
15-
import { createMockVariantAnalysis } from "../../vscode-tests/factories/remote-queries/shared/variant-analysis";
16-
import { createMockRepositoryWithMetadata } from "../../vscode-tests/factories/remote-queries/shared/repository";
17-
import { createMockScannedRepo } from "../../vscode-tests/factories/remote-queries/shared/scanned-repositories";
15+
import { createMockVariantAnalysis } from "../../../test/factories/remote-queries/shared/variant-analysis";
16+
import { createMockRepositoryWithMetadata } from "../../../test/factories/remote-queries/shared/repository";
17+
import { createMockScannedRepo } from "../../../test/factories/remote-queries/shared/scanned-repositories";
1818

1919
import * as analysesResults from "../remote-queries/data/analysesResultsMessage.json";
2020

extensions/ql-vscode/src/stories/variant-analysis/VariantAnalysisHeader.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
VariantAnalysisRepoStatus,
99
VariantAnalysisStatus,
1010
} from "../../remote-queries/shared/variant-analysis";
11-
import { createMockVariantAnalysis } from "../../vscode-tests/factories/remote-queries/shared/variant-analysis";
12-
import { createMockScannedRepo } from "../../vscode-tests/factories/remote-queries/shared/scanned-repositories";
11+
import { createMockVariantAnalysis } from "../../../test/factories/remote-queries/shared/variant-analysis";
12+
import { createMockScannedRepo } from "../../../test/factories/remote-queries/shared/scanned-repositories";
1313

1414
export default {
1515
title: "Variant Analysis/Variant Analysis Header",

0 commit comments

Comments
 (0)