Skip to content

Commit 4fa5355

Browse files
Merge pull request #1702 from github/elena/de-gulp
Don't run gulp for integration test commands
2 parents 7cff1fb + 20e7432 commit 4fa5355

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ We have several types of tests:
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`.
106+
105107
#### Running the tests
106108

109+
Pre-requisites:
110+
1. Run `npm run build`.
111+
2. You will need to have `npm run watch` running in the background.
112+
107113
##### 1. From the terminal
108114

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:
115+
Then, from the `extensions/ql-vscode` directory, use the appropriate command to run the tests:
110116

111117
* Unit tests: `npm run test:unit`
112118
* View Tests: `npm test:view`

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as gulp from 'gulp';
22
import { compileTypeScript, watchTypeScript, cleanOutput } from './typescript';
33
import { compileTextMateGrammar } from './textmate';
4-
import { copyTestData } from './tests';
4+
import { copyTestData, watchTestData } from './tests';
55
import { compileView, watchView } from './webpack';
66
import { packageExtension } from './package';
77
import { injectAppInsightsKey } from './appInsights';
@@ -21,6 +21,7 @@ export {
2121
watchView,
2222
compileTypeScript,
2323
copyTestData,
24+
watchTestData,
2425
injectAppInsightsKey,
2526
compileView,
2627
};

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import * as gulp from 'gulp';
22

33
export function copyTestData() {
4-
copyNoWorkspaceData();
5-
copyCliIntegrationData();
6-
return Promise.resolve();
4+
return Promise.all([
5+
copyNoWorkspaceData(),
6+
copyCliIntegrationData()
7+
]);
8+
}
9+
10+
export function watchTestData() {
11+
return gulp.watch(['src/vscode-tests/*/data/**/*'], copyTestData);
712
}
813

914
function copyNoWorkspaceData() {

extensions/ql-vscode/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,14 +1253,14 @@
12531253
"watch": "npm-run-all -p watch:*",
12541254
"watch:extension": "tsc --watch",
12551255
"watch:webpack": "gulp watchView",
1256+
"watch:files": "gulp watchTestData",
12561257
"test": "npm-run-all -p test:*",
12571258
"test:unit": "mocha --config .mocharc.json test/pure-tests/**/*.ts",
12581259
"test:view": "jest",
1259-
"integration-setup": "rm -rf ./out/vscode-tests && gulp",
1260-
"integration": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",
1261-
"integration:no-workspace": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js no-workspace",
1262-
"integration:minimal-workspace": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js minimal-workspace",
1263-
"cli-integration": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js cli-integration",
1260+
"integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",
1261+
"integration:no-workspace": "node ./out/vscode-tests/run-integration-tests.js no-workspace",
1262+
"integration:minimal-workspace": "node ./out/vscode-tests/run-integration-tests.js minimal-workspace",
1263+
"cli-integration": "node ./out/vscode-tests/run-integration-tests.js cli-integration",
12641264
"update-vscode": "node ./node_modules/vscode/bin/install",
12651265
"format": "tsfmt -r && eslint . --ext .ts,.tsx --fix",
12661266
"lint": "eslint . --ext .ts,.tsx --max-warnings=0",

0 commit comments

Comments
 (0)