microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
bumo-glob-cli-fix

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

gulp_scripts/tester.js

73lines · modeblame

c29f0740benjaminbi3 years ago1const gulp = require("gulp");
2const log = require("fancy-log");
3const minimist = require("minimist");
4const path = require("path");
023ff13fEzio Li3 years ago5const vscodeTest = require("@vscode/test-electron");
c29f0740benjaminbi3 years ago6const getBuilder = require("./builder");
7const getFormatter = require("./formatter");
8
9const vscodeVersionForTests = "stable";
10
11const knownOptions = {
12string: "env",
13default: { env: "production" },
14};
15const options = minimist(process.argv.slice(2), knownOptions);
16
17async function test(inspectCodeCoverage = false) {
18// Check if arguments were passed
19// if (options.pattern) {
20// log(`\nTesting cases that match pattern: ${options.pattern}`);
21// } else {
22// log(`\nTesting cases that don't match pattern: extensionContext|localizationContext`);
23// }
24
25if (options != null) {
26log(`\nArgument passed.`);
27} else {
28log(`\nArgument not passed.`);
29}
30
31try {
32// The folder containing the Extension Manifest package.json
33// Passed to `--extensionDevelopmentPath`
34const extensionDevelopmentPath = __dirname;
35
36// The path to the extension test runner script
37// Passed to --extensionTestsPath
38const extensionTestsPath = path.resolve(__dirname, "test", "index");
39console.log(extensionTestsPath);
40// Download VS Code, unzip it and run the integration test
41
42const testOptions = {
43extensionDevelopmentPath,
44extensionTestsPath,
45version: vscodeVersionForTests,
46};
47
48// Activate inspection of code coverage with unit tests
49if (inspectCodeCoverage) {
50testOptions.extensionTestsEnv = {
51COVERAGE: "true",
52};
53}
54
55await vscodeTest.runTests(testOptions);
56} catch (err) {
57console.error(err);
58console.error("Failed to run tests");
59process.exit(1);
60}
61}
62
63const testTask = gulp.series(getBuilder.buildTask, getFormatter.lint, test);
64
65const testCoverage = gulp.series(gulp.series(getBuilder.buildDev), async function () {
66await test(true);
67});
68
69module.exports = {
70test,
71testTask,
72testCoverage,
e4001e74benjaminbi3 years ago73};