-
Notifications
You must be signed in to change notification settings - Fork 7
/
cli.ts
60 lines (58 loc) · 1.67 KB
/
cli.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env node
import yargs from 'yargs';
yargs(process.argv.slice(2))
.demandCommand(1, 'Use one of the above commands')
.command(
'list',
'List all the scenarios defined in your test suite',
yargs =>
yargs
.option('files', {
type: 'string',
description: 'globs for all your test files',
demandOption: true,
})
.array('files')
.option('require', {
type: 'string',
description: 'module(s) to require before we try to load your tests.',
})
.array('require')
.option('matrix', { type: 'string' }),
async argv => {
let mod = await import('./list.js');
await mod.printList(argv);
}
)
.command(
'output',
'Write out one of your test scenario apps as a real app on disk, so you can inspect, debug, and run it',
yargs =>
yargs
.option('scenario', {
type: 'string',
description: 'Name of scenario. The first scenario to contain this substring will be chosen.',
demandOption: true,
})
.option('outdir', {
type: 'string',
description: 'Where to write the app',
default: 'output',
})
.option('files', {
type: 'string',
description: 'globs for all your test files',
demandOption: true,
})
.array('files')
.option('require', {
type: 'string',
description: 'module(s) to require before we try to load your tests.',
})
.array('require'),
async argv => {
let mod = await import('./output.js');
await mod.output(argv);
}
)
.help().argv;