Skip to content

Commit 78d3ebc

Browse files
committed
refactor: rebuild-check-single.js
1 parent 2cc5baa commit 78d3ebc

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

rebuild-check-single.js

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
var _ = require('lodash');
2-
var exec = require('child_process').execSync;
3-
var fs = require('fs');
4-
var path = require('path');
5-
var yargs = require('yargs');
6-
const rimraf = require('rimraf');
1+
const { execSync } = require("child_process");
72

8-
let args = process.argv.length <= 2 ? [] : process.argv.slice(2, process.argv.length);
3+
const args = process.argv.slice(2);
4+
const frameworks = args.filter((a) => !a.startsWith("--"));
5+
const frameworkNames = frameworks.join(" ");
96

10-
let frameworks = args.filter(a => !a.startsWith("--"));
11-
12-
console.log("rebuild-check-single.js started: args", args, "frameworks", frameworks);
7+
console.log(
8+
"rebuild-check-single.js started: args",
9+
args,
10+
"frameworks",
11+
frameworks
12+
);
1313

1414
/*
1515
rebuild-single.js [--ci] [--docker] [keyed/framework1 ... non-keyed/frameworkN]
@@ -25,25 +25,26 @@ Pass list of frameworks
2525
*/
2626

2727
try {
28-
let frameworkNames = frameworks.join(" ");
29-
let bench_cmd = 'npm run bench -- --headless true --smoketest true ' + frameworkNames;
30-
console.log(bench_cmd);
31-
exec(bench_cmd, {
32-
cwd: 'webdriver-ts',
33-
stdio: 'inherit'
34-
});
35-
36-
let keyed_cmd = 'npm run isKeyed -- --headless true ' + frameworkNames;
37-
console.log(keyed_cmd);
38-
exec(keyed_cmd, {
39-
cwd: 'webdriver-ts',
40-
stdio: 'inherit'
41-
});
42-
43-
console.log("rebuild-check-single.js finished");
44-
console.log("All checks are fine!");
45-
console.log("======> Please rerun the benchmark: npm run bench ", frameworkNames);
28+
const benchCmd = `npm run bench -- --headless true --smoketest true ${frameworkNames}`;
29+
console.log(benchCmd);
30+
execSync(benchCmd, {
31+
cwd: "webdriver-ts",
32+
stdio: "inherit",
33+
});
34+
35+
const keyedCmd = `npm run isKeyed -- --headless true ${frameworkNames}`;
36+
console.log(keyedCmd);
37+
execSync(keyedCmd, {
38+
cwd: "webdriver-ts",
39+
stdio: "inherit",
40+
});
41+
42+
console.log("rebuild-check-single.js finished");
43+
console.log("All checks are fine!");
44+
console.log(
45+
`======> Please rerun the benchmark: npm run bench ${frameworkNames}`
46+
);
4647
} catch (e) {
47-
console.log(`rebuild-check-single failed for ${frameworks.join(" ")}`);
48-
process.exit(-1);
49-
}
48+
console.log(`rebuild-check-single failed for ${frameworks.join(" ")}`);
49+
process.exit(-1);
50+
}

0 commit comments

Comments
 (0)