From 3732dd0e9c7b479afdda82cfe78c96f313db7a86 Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Sat, 1 Jun 2019 15:03:41 +0200 Subject: [PATCH] chore: wip --- test/cli.test.js | 2 +- test/helpers/test-bin.js | 29 +---------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/test/cli.test.js b/test/cli.test.js index a97386f6b0..12fbc0db8c 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -100,7 +100,7 @@ describe('CLI', () => { .catch(done); }); - it.skip('should accept the promise function of webpack.config.js', (done) => { + it('should accept the promise function of webpack.config.js', (done) => { testBin( false, resolve(__dirname, 'fixtures/promise-config/webpack.config.js') diff --git a/test/helpers/test-bin.js b/test/helpers/test-bin.js index 50a6fc15b8..79c827522f 100644 --- a/test/helpers/test-bin.js +++ b/test/helpers/test-bin.js @@ -30,34 +30,7 @@ function testBin(testArgs, configPath) { const args = [webpackDevServerPath, '--config', configPath].concat(testArgs); - return new Promise((resolve, reject) => { - const child = execa('node', args, { cwd, env }); - - child.on('error', (error) => reject(error)); - - child.stdout.on('data', (data) => { - const str = data.toString(); - - stdout += str; - - console.log('=-=', str); - // if webpack.config.js is a promise function, it won't be able to call `close` - // if (str.includes('Compiled successfully.')) { - // child.kill('SIGINT'); - // } - }); - - child.stderr.on('data', (data) => { - stderr += data.toString(); - }); - - child.on('close', (code) => { - if (code !== 0) { - return reject(stderr); - } - resolve({ stdout, stderr, code }); - }); - }); + return execa('node', args, { cwd, env, timeout: 2000 }); } module.exports = testBin;