forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
69 lines (60 loc) · 2.36 KB
/
index.ts
File metadata and controls
69 lines (60 loc) · 2.36 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
// tslint:disable-next-line:no-any
if ((Reflect as any).metadata === undefined) {
// tslint:disable-next-line:no-require-imports no-var-requires
require('reflect-metadata');
}
import {
IS_CI_SERVER_TEST_DEBUGGER,
IS_VSTS, MOCHA_CI_PROPERTIES, MOCHA_CI_REPORTER_ID,
MOCHA_CI_REPORTFILE, MOCHA_REPORTER_JUNIT
} from './ciConstants';
import { IS_MULTI_ROOT_TEST } from './constants';
import * as testRunner from './testRunner';
process.env.VSC_PYTHON_CI_TEST = '1';
process.env.IS_MULTI_ROOT_TEST = IS_MULTI_ROOT_TEST.toString();
// If running on CI server and we're running the debugger tests, then ensure we only run debug tests.
// We do this to ensure we only run debugger test, as debugger tests are very flaky on CI.
// So the solution is to run them separately and first on CI.
const grep = IS_CI_SERVER_TEST_DEBUGGER ? 'Debug' : undefined;
const testFilesSuffix = process.env.TEST_FILES_SUFFIX;
// You can directly control Mocha options by uncommenting the following lines.
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info.
// Hack, as retries is not supported as setting in tsd.
const options: testRunner.SetupOptions & { retries: number } = {
ui: 'tdd',
useColors: true,
timeout: 25000,
retries: 3,
grep,
testFilesSuffix
};
// VSTS CI doesn't display colours correctly (yet).
if (IS_VSTS) {
options.useColors = false;
}
// CI can ask for a JUnit reporter if the environment variable
// 'MOCHA_REPORTER_JUNIT' is defined, further control is afforded
// by other 'MOCHA_CI_...' variables. See constants.ts for info.
if (MOCHA_REPORTER_JUNIT) {
options.reporter = MOCHA_CI_REPORTER_ID;
options.reporterOptions = {
mochaFile: MOCHA_CI_REPORTFILE,
properties: MOCHA_CI_PROPERTIES
};
}
process.on('unhandledRejection', (ex: string | Error, a) => {
const message = [`${ex}`];
if (typeof ex !== 'string' && ex && ex.message) {
message.push(ex.name);
message.push(ex.message);
if (ex.stack) {
message.push(ex.stack);
}
}
console.error(`Unhandled Promise Rejection with the message ${message.join(', ')}`);
});
testRunner.configure(options, { coverageConfig: '../coverconfig.json' });
module.exports = testRunner;