startup.js 950 Bytes
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}`);
// })