Procházet zdrojové kódy

add flag to prevent multiple test

陈帅 před 7 roky
rodič
revize
60822779e3
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. 5 1
      tests/run-tests.js

+ 5 - 1
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',