-
Notifications
You must be signed in to change notification settings - Fork 1
/
nightwatch.js
40 lines (31 loc) · 999 Bytes
/
nightwatch.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
/*eslint no-console:0 */
'use strict';
require('core-js/stable');
process.env.NODE_ENV = 'integration-test';
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.config');
const open = require('open');
var spawn = require('cross-spawn');
const server = new WebpackDevServer(webpack(config), config.devServer);
server.listen(config.devServer.port, 'localhost', (err) => {
if (err) {
console.error(err);
}
console.info('Listening at localhost:' + config.devServer.port);
console.info('Opening your system browser...');
});
var opts = process.argv.slice(2);
if (opts.indexOf('--config') === -1) {
opts = opts.concat(['--config', 'nightwatch.json']);
}
var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' });
runner.on('exit', function (code) {
server.close();
process.exit(code);
});
runner.on('error', function (err) {
console.error(err);
server.close();
throw err
});