-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.mjs
48 lines (41 loc) · 890 Bytes
/
index.mjs
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
#!/usr/bin/env node
'use strict';
import { main as jest } from './jest/index.mjs';
import { main as karma } from './karma/index.mjs';
import { main as jasmine } from './jasmine/index.mjs';
import { createInterface } from 'readline';
function main(type = process.argv[2]) {
switch (type) {
case 'jasmine':
jasmine();
break;
case 'karma':
karma();
break;
case 'jest':
jest();
break;
default:
select();
break;
}
}
function select() {
const tools = {
1: 'jest',
2: 'karma',
3: 'jasmine',
};
const cli = createInterface({
input: process.stdin,
output: process.stdout,
});
const options = Object.entries(tools)
.map(([a, b]) => ` ${a}: ${b}`)
.join('\n');
cli.question(`Which tool to use? \n${options}\n> `, (answer) => {
cli.close();
main(tools[answer]);
});
}
main();