Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/sanity/src/index.ts
4772 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import minimist from 'minimist';
7
import Mocha, { MochaOptions } from 'mocha';
8
9
const options = minimist(process.argv.slice(2), {
10
string: ['fgrep', 'grep'],
11
boolean: ['help'],
12
alias: { fgrep: 'f', grep: 'g', help: 'h' },
13
});
14
15
if (options.help) {
16
console.info('Usage: npm run sanity-test -- [options]');
17
console.info('Options:');
18
console.info(' --commit, -c <commit> The commit to test (required)');
19
console.info(` --quality, -q <quality> The quality to test (required, "stable", "insider" or "exploration")`);
20
console.info(' --no-cleanup Do not cleanup downloaded files after each test');
21
console.info(' --grep, -g <pattern> Only run tests matching the given <pattern>');
22
console.info(' --fgrep, -f <string> Only run tests containing the given <string>');
23
console.info(' --verbose, -v Enable verbose logging');
24
console.info(' --help, -h Show this help message');
25
process.exit(0);
26
}
27
28
const mochaOptions: MochaOptions = {
29
color: true,
30
timeout: 5 * 60 * 1000,
31
slow: 3 * 60 * 1000,
32
grep: options.grep,
33
fgrep: options.fgrep,
34
};
35
36
const mocha = new Mocha(mochaOptions);
37
mocha.addFile(require.resolve('./main.js'));
38
mocha.run(failures => {
39
process.exitCode = failures > 0 ? 1 : 0;
40
});
41
42