From 60822779e3af7ea63097d2b95af4676f86b42134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Mon, 1 Oct 2018 19:12:48 +0800 Subject: [PATCH] add flag to prevent multiple test --- tests/run-tests.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/run-tests.js b/tests/run-tests.js index a5e687a9..c6904709 100644 --- a/tests/run-tests.js +++ b/tests/run-tests.js @@ -4,6 +4,9 @@ const { kill } = require('cross-port-killer'); const env = Object.create(process.env); env.BROWSER = 'none'; env.TEST = true; +// flag to prevent multiple test +let once = false; + const startServer = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['start'], { env, }); @@ -22,8 +25,9 @@ console.log('Starting development server for e2e tests...'); startServer.stdout.on('data', data => { // eslint-disable-next-line console.log(data.toString()); - if (data.toString().indexOf('App running at') >= 0) { + if (!once && data.toString().indexOf('App running at') >= 0) { // eslint-disable-next-line + once = true; console.log('Development server is started, ready to run tests.'); const testCmd = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['test'], { stdio: 'inherit', -- GitLab