test: make run-as-node --inspect test more robust on windows
This commit is contained in:
parent
b11b4f2235
commit
0ee46cdc26
1 changed files with 15 additions and 6 deletions
|
@ -221,14 +221,23 @@ describe('node feature', () => {
|
|||
})
|
||||
|
||||
let output = ''
|
||||
child.stderr.on('data', (data) => {
|
||||
function cleanup () {
|
||||
child.stderr.removeListener('data', errorDataListener)
|
||||
child.stdout.removeListener('data', outDataHandler)
|
||||
}
|
||||
function errorDataListener (data) {
|
||||
output += data
|
||||
if (output.trim().startsWith('Debugger listening on ws://')) done()
|
||||
})
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
if (output.trim().startsWith('Debugger listening on ws://')) {
|
||||
cleanup()
|
||||
done()
|
||||
}
|
||||
}
|
||||
function outDataHandler (data) {
|
||||
cleanup()
|
||||
done(new Error(`Unexpected output: ${data.toString()}`))
|
||||
})
|
||||
}
|
||||
child.stderr.on('data', errorDataListener)
|
||||
child.stdout.on('data', outDataHandler)
|
||||
})
|
||||
|
||||
it('supports js binding', (done) => {
|
||||
|
|
Loading…
Reference in a new issue