test: make run-as-node --inspect test more robust on windows

This commit is contained in:
Samuel Attard 2018-10-02 16:36:22 +10:00 committed by Aleksei Kuzmin
parent b11b4f2235
commit 0ee46cdc26

View file

@ -221,14 +221,23 @@ describe('node feature', () => {
}) })
let output = '' let output = ''
child.stderr.on('data', (data) => { function cleanup () {
child.stderr.removeListener('data', errorDataListener)
child.stdout.removeListener('data', outDataHandler)
}
function errorDataListener (data) {
output += data output += data
if (output.trim().startsWith('Debugger listening on ws://')) done() if (output.trim().startsWith('Debugger listening on ws://')) {
}) cleanup()
done()
child.stdout.on('data', (data) => { }
}
function outDataHandler (data) {
cleanup()
done(new Error(`Unexpected output: ${data.toString()}`)) done(new Error(`Unexpected output: ${data.toString()}`))
}) }
child.stderr.on('data', errorDataListener)
child.stdout.on('data', outDataHandler)
}) })
it('supports js binding', (done) => { it('supports js binding', (done) => {