1 |
|
2 | process.env.NODE_ENV = 'testing'
|
3 | var server = require('../../build/dev-server.js')
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | var opts = process.argv.slice(2)
|
13 | if (opts.indexOf('--config') === -1) {
|
14 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
|
15 | }
|
16 | if (opts.indexOf('--env') === -1) {
|
17 | opts = opts.concat(['--env', 'chrome'])
|
18 | }
|
19 |
|
20 | var spawn = require('cross-spawn')
|
21 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
|
22 |
|
23 | runner.on('exit', function (code) {
|
24 | server.close()
|
25 | process.exit(code)
|
26 | })
|
27 |
|
28 | runner.on('error', function (err) {
|
29 | server.close()
|
30 | throw err
|
31 | })
|