microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
acccf52d2cadd4330d080a50366e21b3456ff0d4

Branches

Tags

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

Clone

HTTPS

Download ZIP

gulp_scripts/tester.js

73lines · modecode

1const gulp = require("gulp");
2const log = require("fancy-log");
3const minimist = require("minimist");
4const path = require("path");
5const vscodeTest = require("@vscode/test-electron");
6const getBuilder = require("./builder");
7const getFormatter = require("./formatter");
8
9const vscodeVersionForTests = "stable";
10
11const knownOptions = {
12 string: "env",
13 default: { 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
25 if (options != null) {
26 log(`\nArgument passed.`);
27 } else {
28 log(`\nArgument not passed.`);
29 }
30
31 try {
32 // The folder containing the Extension Manifest package.json
33 // Passed to `--extensionDevelopmentPath`
34 const extensionDevelopmentPath = __dirname;
35
36 // The path to the extension test runner script
37 // Passed to --extensionTestsPath
38 const extensionTestsPath = path.resolve(__dirname, "test", "index");
39 console.log(extensionTestsPath);
40 // Download VS Code, unzip it and run the integration test
41
42 const testOptions = {
43 extensionDevelopmentPath,
44 extensionTestsPath,
45 version: vscodeVersionForTests,
46 };
47
48 // Activate inspection of code coverage with unit tests
49 if (inspectCodeCoverage) {
50 testOptions.extensionTestsEnv = {
51 COVERAGE: "true",
52 };
53 }
54
55 await vscodeTest.runTests(testOptions);
56 } catch (err) {
57 console.error(err);
58 console.error("Failed to run tests");
59 process.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 () {
66 await test(true);
67});
68
69module.exports = {
70 test,
71 testTask,
72 testCoverage,
73};
74