Merge pull request #1702 from github/elena/de-gulp

Don't run gulp for integration test commands
This commit is contained in:
Elena Tanasoiu
2022-11-03 13:02:28 +00:00
committed by GitHub
4 changed files with 22 additions and 10 deletions

View File

@@ -102,11 +102,17 @@ We have several types of tests:
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.
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`.
#### Running the tests
Pre-requisites:
1. Run `npm run build`.
2. You will need to have `npm run watch` running in the background.
##### 1. From the terminal
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:
Then, from the `extensions/ql-vscode` directory, use the appropriate command to run the tests:
* Unit tests: `npm run test:unit`
* View Tests: `npm test:view`

View File

@@ -1,7 +1,7 @@
import * as gulp from 'gulp';
import { compileTypeScript, watchTypeScript, cleanOutput } from './typescript';
import { compileTextMateGrammar } from './textmate';
import { copyTestData } from './tests';
import { copyTestData, watchTestData } from './tests';
import { compileView, watchView } from './webpack';
import { packageExtension } from './package';
import { injectAppInsightsKey } from './appInsights';
@@ -21,6 +21,7 @@ export {
watchView,
compileTypeScript,
copyTestData,
watchTestData,
injectAppInsightsKey,
compileView,
};

View File

@@ -1,9 +1,14 @@
import * as gulp from 'gulp';
export function copyTestData() {
copyNoWorkspaceData();
copyCliIntegrationData();
return Promise.resolve();
return Promise.all([
copyNoWorkspaceData(),
copyCliIntegrationData()
]);
}
export function watchTestData() {
return gulp.watch(['src/vscode-tests/*/data/**/*'], copyTestData);
}
function copyNoWorkspaceData() {

View File

@@ -1253,14 +1253,14 @@
"watch": "npm-run-all -p watch:*",
"watch:extension": "tsc --watch",
"watch:webpack": "gulp watchView",
"watch:files": "gulp watchTestData",
"test": "npm-run-all -p test:*",
"test:unit": "mocha --config .mocharc.json test/pure-tests/**/*.ts",
"test:view": "jest",
"integration-setup": "rm -rf ./out/vscode-tests && gulp",
"integration": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",
"integration:no-workspace": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js no-workspace",
"integration:minimal-workspace": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js minimal-workspace",
"cli-integration": "npm run integration-setup && node ./out/vscode-tests/run-integration-tests.js cli-integration",
"integration": "node ./out/vscode-tests/run-integration-tests.js no-workspace,minimal-workspace",
"integration:no-workspace": "node ./out/vscode-tests/run-integration-tests.js no-workspace",
"integration:minimal-workspace": "node ./out/vscode-tests/run-integration-tests.js minimal-workspace",
"cli-integration": "node ./out/vscode-tests/run-integration-tests.js cli-integration",
"update-vscode": "node ./node_modules/vscode/bin/install",
"format": "tsfmt -r && eslint . --ext .ts,.tsx --fix",
"lint": "eslint . --ext .ts,.tsx --max-warnings=0",