-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathcli.ts
More file actions
85 lines (78 loc) · 1.73 KB
/
Copy pathcli.ts
File metadata and controls
85 lines (78 loc) · 1.73 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import yargs from 'yargs';
import { DEBUG_SUBPROCESS } from '../config';
import { runMocha } from './runner';
import { ThreadOptions } from '../thread';
interface Args {
bail?: boolean;
compilers: string[];
delay?: boolean;
grep?: string;
enableTimeouts?: boolean;
exit?: boolean;
['full-trace']?: boolean;
require: string[];
retries?: number;
slow?: number;
timeout?: number;
test: string;
file: string[];
ui?: string;
}
function isDebugSubprocesss(argv: Args) {
return argv[DEBUG_SUBPROCESS.yargs] as boolean;
}
function threadOptionsFromArgv(argv: Args): ThreadOptions {
return {
bail: argv.bail,
compilers: argv.compilers,
delay: argv.delay || false,
enableTimeouts: argv.enableTimeouts,
exitImmediately: argv.exit || false,
fullTrace: argv['full-trace'] || false,
grep: argv.grep,
isTypescriptRunMode: isDebugSubprocesss(argv),
requires: argv.require,
retries: argv.retries,
slow: argv.slow,
timeout: argv.timeout,
file: argv.file,
ui: argv.ui
};
}
const argv: Args = yargs
.boolean('bail')
.option('compilers', {
array: true,
default: [],
})
.boolean('delay')
.string('grep')
.boolean('enableTimeouts')
.option('exit', {
boolean: true,
})
.option('full-trace', {
boolean: true,
})
.number('slow')
.option('test', {
demandOption: true,
string: true,
})
.option('require', {
array: true,
default: [],
})
.option('file', {
array: true,
default: []
})
.number('retries')
.number('timeout')
.option('ui', {
string: true,
})
.parse(process.argv);
const debugSubprocess = isDebugSubprocesss(argv);
const options = threadOptionsFromArgv(argv);
runMocha(argv.test, options, debugSubprocess);