Skip to content

Commit

Permalink
Merge e4a4dc0 into 7b2942c
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjbarton authored Apr 13, 2020
2 parents 7b2942c + e4a4dc0 commit 905fd72
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 2 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions test/e2e/step_definitions/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ cucumber.defineSupportCode((a) => {
a.After(function (scenario, callback) {
const running = this.child != null && typeof this.child.kill === 'function'

if (running) {
this.child.kill()
this.child = null
}

// stop the proxy if it was started
this.proxy.stop(callback)
this.proxy.stop(() => {
if (running) {
this.child.kill()
this.child = null
}
callback()
})
})
})
8 changes: 8 additions & 0 deletions test/e2e/support/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ function Proxy () {
target: 'http://localhost:9876'
})

self.proxy.on('error', function proxyError (err, req, res) {
console.log('support/proxy onerror', err)
})

self.server = http.createServer(function (req, res) {
const url = req.url
const match = url.match(self.proxyPathRegExp)
Expand All @@ -22,6 +26,10 @@ function Proxy () {
}
})

self.server.on('clientError', (err, socket) => {
console.log('support/proxy clientError', err)
})

self.start = function (port, proxyPath, callback) {
self.proxyPathRegExp = new RegExp('^' + proxyPath + '(.*)')
self.server.listen(port, function (error) {
Expand Down

0 comments on commit 905fd72

Please sign in to comment.