-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexpf.mjs
More file actions
executable file
·112 lines (96 loc) · 1.88 KB
/
expf.mjs
File metadata and controls
executable file
·112 lines (96 loc) · 1.88 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env node
import { parseArgs } from 'node:util';
import { argv } from 'node:process';
const { values, positionals } = parseArgs({
args: argv,
allowPositionals: true,
allowNegative: true,
options: {
help: {
type: 'boolean'
},
cwd: {
type: 'string'
},
repo: {
type: 'string'
},
'repo-ref': {
type: 'string'
},
runner: {
type: 'string',
short: 'u'
},
test: {
type: 'string',
short: 't'
},
node: {
type: 'string',
short: 'n'
},
overrides: {
type: 'string',
short: 'o'
},
config: {
type: 'string',
short: 'c'
},
write: {
type: 'boolean'
},
parallel: {
type: 'boolean',
default: false
},
duration: {
type: 'string',
short: 'd'
},
'force-rebuild': {
type: 'boolean'
}
}
});
// Convert cli friendly values to JS friendly values
values.repoRef = values['repo-ref'];
delete values['repo-ref'];
values.forceRebuild = values['force-rebuild'];
delete values['force-rebuild'];
switch (positionals[2]) {
case 'compare':
try {
await (await import('../compare.mjs')).default(values, ...positionals.slice(3));
} catch (e) {
console.error(e);
process.exit(1);
}
break;
case 'load':
try {
await (await import('../load.mjs')).default(values);
} catch (e) {
console.error(e);
process.exit(1);
}
break;
case 'bench':
try {
await (await import('../bench.mjs')).default(values);
} catch (e) {
console.error(e);
process.exit(1);
}
break;
default:
console.log(`
Express Performance Testing CLI
===============================
${(await import('../compare.mjs')).help(values)}
${(await import('../load.mjs')).help(values)}
${(await import('../bench.mjs')).help(values)}
`
);
}