Skip to content

Instantly share code, notes, and snippets.

@DrPep
Last active March 18, 2019 00:02
Show Gist options
  • Save DrPep/05955fe8b51735fd0b7ddbf72198b8a4 to your computer and use it in GitHub Desktop.
Save DrPep/05955fe8b51735fd0b7ddbf72198b8a4 to your computer and use it in GitHub Desktop.
End 2 End tests for VueJS using Webpack Dev Server - start server, wait for response, continue
const { spawn } = require('child-process-promise')
const waitOn = require('wait-on')
let childProcess
exports.config = {
tests: './test/tests/*_test.js',
output: './output',
helpers: {
Puppeteer: {
url: 'http://localhost:8080',
show: true
}
},
include: {
I: './test/support/steps_file.js'
},
bootstrap: function (done) {
let promise = spawn('./node_modules/.bin/vue-cli-service', ['serve'])
childProcess = promise.childProcess
console.log('[spawn] childProcess.pid: ', childProcess.pid)
childProcess.stdout.on('data', function (data) {
console.log('[spawn] stdout: ', data.toString())
});
waitOn({resources: ['http://localhost:8080']})
.then(done)
.catch(function (err) {
handleError(err)
done()
});
promise.then(function () {
console.log('[spawn] done!')
}).catch(function (err) {
console.error('[spawn] ERROR: ', err)
});
},
teardown: function (done) {
childProcess.kill('SIGTERM')
done()
},
mocha: {},
name: 'APP NAME'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment