forked from Dart-Code/Dart-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_runner.ts
36 lines (32 loc) · 1.33 KB
/
test_runner.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
console.log("Starting test runner...");
import * as fs from "fs";
import { MultiReporter } from "./mocha_multi_reporter";
import testRunner = require("vscode/lib/testrunner");
const onExit = require("signal-exit"); // tslint:disable-line:no-var-requires
// Ensure we write coverage on exit.
declare const __coverage__: any;
onExit(() => {
// Unhandled exceptions here seem to hang, but console.error+process.exit do not! ¯\_(ツ)_/¯
try {
if (typeof __coverage__ !== "undefined" && typeof process.env.COVERAGE_OUTPUT !== "undefined" && process.env.COVERAGE_OUTPUT) {
fs.writeFileSync(process.env.COVERAGE_OUTPUT, JSON.stringify(__coverage__));
}
} catch (e) {
console.error(e);
process.exit(1);
}
});
testRunner.configure({
forbidOnly: !!process.env.MOCHA_FORBID_ONLY,
reporter: MultiReporter,
reporterOptions: {
output: process.env.TEST_XML_OUTPUT,
summaryFile: process.env.TEST_CSV_SUMMARY,
testRunName: process.env.TEST_RUN_NAME,
},
slow: 10000, // increased threshold before marking a test as slow
timeout: 120000, // increased timeout because starting up Code, Analyzer, Pub, etc. is slooow
ui: "bdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true, // colored output from test results
} as MochaSetupOptions & { reporterOptions: any });
module.exports = testRunner;