From 9708c0a3bd25bc2f5bd7519c7f6d8f20b218972d Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 11 Apr 2019 16:44:10 +0100 Subject: [PATCH] fix: flakey windows test (#1987) License: MIT Signed-off-by: Alan Shaw --- test/cli/daemon.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/cli/daemon.js b/test/cli/daemon.js index afebfbbc41..c7639b21ab 100644 --- a/test/cli/daemon.js +++ b/test/cli/daemon.js @@ -109,7 +109,7 @@ describe('daemon', () => { await ipfs('config', 'Addresses.API', JSON.stringify(apiAddrs), '--json') await ipfs('config', 'Addresses.Gateway', JSON.stringify(gatewayAddrs), '--json') - const out = await new Promise(resolve => { + const out = await new Promise((resolve, reject) => { const res = ipfs('daemon') let out = '' @@ -117,8 +117,9 @@ describe('daemon', () => { out += data if (out.includes('Daemon is ready')) { res.stdout.removeListener('data', onData) + const onKilled = () => resolve(out) + res.then(onKilled).catch(onKilled) res.kill() - resolve(out) } }) }) @@ -134,7 +135,7 @@ describe('daemon', () => { await ipfs('config', 'Addresses.API', '[]', '--json') await ipfs('config', 'Addresses.Gateway', '[]', '--json') - const out = await new Promise(resolve => { + const out = await new Promise((resolve, reject) => { const res = ipfs('daemon') let out = '' @@ -142,8 +143,9 @@ describe('daemon', () => { out += data if (out.includes('Daemon is ready')) { res.stdout.removeListener('data', onData) + const onKilled = () => resolve(out) + res.then(onKilled).catch(onKilled) res.kill() - resolve(out) } }) })