startup.js
950 Bytes
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
const {fork} = require('child_process');
const open = require('open');
const _ = require('lodash');
const config = require('./config.json');
const fs = require('fs');
const path = require('path');
global.TEST_PLATFORM = process.argv[2] === '--ios' ? 'ios' : 'android';
const dist = `./test/${global.TEST_PLATFORM}`;
let caseFiles = [];
if (process.argv[3]) {
caseFiles = caseFiles.concat(process.argv.slice(3).map(file => `${dist}/${file}`));
}
if (!caseFiles.length) {
fs
.readdirSync(path.join(__dirname, dist))
.filter(file => {
return (file.indexOf('.') !== 0) && (file.slice(-3) === '.js');
})
.forEach(file => {
caseFiles.push(`${dist}/${file}`)
});
}
_.each(caseFiles, file => {
require(file);
});
require('./proxy-server/server');
setTimeout(() => {
require('./libs/bootstrap.js');
}, 500);
// child.on('close', code => {
// open(`http://localhost:${config.port}/report?code=${code}`);
// })