-
Notifications
You must be signed in to change notification settings - Fork 24
/
index.js
executable file
·49 lines (41 loc) · 1.91 KB
/
index.js
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
#!/usr/bin/env node
/**
* Copyright(c) 2019, prprprus All rights reserved.
* Use of this source code is governed by a BSD - style.
* license that can be found in the LICENSE file.
*/
global.__basedir = __dirname;
const commander = require('commander');
const child_process = require('child_process');
const proc = require(__basedir + '/src/utils/process');
const program = new commander.Command();
/**
* Run softest.
*
* @param {string} host - Server hostname (default: 127.0.0.1).
* @param {number} port - Server port (default: 2333).
* @param {string} chromium - The absolute path of the chromium execution file.
* @param {string} savePath - Test report save path.
*/
function run(host, port, chromium, savePath) {
const cliProxy = child_process.spawn('node', [__basedir + '/src/server/wss.js', '&']);
proc.captureLog(cliProxy);
const cliRecoder = child_process.spawn('node', [__basedir + '/src/server/web.js', host, port, chromium, savePath]);
proc.captureLog(cliRecoder);
console.log(`
_______ _______ _______ _______ _______ _______ _______
| || || || || || || | status: running
| _____|| _ || ___||_ _|| ___|| _____||_ _| host: ${host}
| |_____ | | | || |___ | | | |___ | |_____ | | port: ${port}
|_____ || |_| || ___| | | | ___||_____ | | |
_____| || || | | | | |___ _____| | | |
|_______||_______||___| |___| |_______||_______| |___|
`);
}
program
.option('-h, --host <hostname>', 'Server hostname, optional.', '127.0.0.1')
.option('-p, --port <port>', 'Server port, optional.', 2333)
.option('-c, --chromium <path>', 'The absolute path of the chromium execution file, necessary.')
.option('-r, --report <path>', 'The absolute path of the test report, necessary.');
program.parse(process.argv);
run(program.host, program.port, program.chromium, program.report);