blob: bf4758fb85f9eecd2c67ef239112d80a4dc4a350 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* eslint-disable */
var path = require('path')
var spawn = require('cross-spawn')
var httpServer = require('http-server')
var server = httpServer.createServer({
root: path.resolve(__dirname, '../../../')
})
server.listen(8088)
var args = process.argv.slice(2)
if (args.indexOf('--config') === -1) {
args = args.concat(['--config', 'build/nightwatch.config.js'])
}
if (args.indexOf('--env') === -1) {
args = args.concat(['--env', 'phantomjs'])
}
var i = args.indexOf('--test')
if (i > -1) {
args[i + 1] = 'html5/test/e2e/specs/' + args[i + 1]
}
var runner = spawn('nightwatch', args, {
stdio: 'inherit'
})
runner.on('exit', function (code) {
server.close()
process.exit(code)
})
runner.on('error', function (err) {
server.close()
throw err
})