From 1762486db3515e4f68d7bec47f77a2b75b93f05e Mon Sep 17 00:00:00 2001 From: Simon Schick Date: Wed, 26 Aug 2020 19:42:00 +0200 Subject: [PATCH 1/2] Rerun tests if client reloads --- package/server.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/package/server.js b/package/server.js index 0489bca..dade876 100644 --- a/package/server.js +++ b/package/server.js @@ -1,6 +1,7 @@ /* global Package */ import { mochaInstance } from 'meteor/meteortesting:mocha-core'; import { startBrowser } from 'meteor/meteortesting:browser-tests'; +import { onMessage } from 'meteor/inter-process-messaging'; import fs from 'fs'; @@ -25,6 +26,7 @@ const { grep, invert, reporter, serverReporter, serverOutput, clientOutput } = m // logging in real time after that if client tests are still running. let serverTestsDone = false; +let clientTestsRunning = false; const clientLines = []; function clientLogBuffer(line) { if (serverTestsDone) { @@ -122,6 +124,11 @@ function serverTests(cb) { } function clientTests() { + if (clientTestsRunning) { + console.log('CLIENT TESTS ALREADY RUNNING'); + return; + } + if (!runnerOptions.runClient) { console.log('SKIPPING CLIENT TESTS BECAUSE TEST_CLIENT=0'); exitIfDone('client', 0); @@ -136,6 +143,7 @@ function clientTests() { } printHeader('CLIENT'); + clientTestsRunning = true; startBrowser({ stdout(data) { @@ -160,6 +168,7 @@ function clientTests() { } }, done(failureCount) { + clientTestsRunning = false; if (typeof failureCount !== 'number') { console.log('The browser driver package did not return a failure count for server tests as expected'); exitIfDone('client', 1); @@ -188,3 +197,13 @@ function start() { } export { start }; + +onMessage('client-refresh', (options) => { + console.log('CLIENT TESTS RESTARTING (client-refresh)', options === undefined ? '' : options); + clientTests() +}); + +onMessage('webapp-reload-client', (options) => { + console.log('CLIENT TESTS RESTARTING (webapp-reload-client)', options === undefined ? '' : options); + clientTests() +}); From 512d06381963786954d53412d2ecd3ab0895517d Mon Sep 17 00:00:00 2001 From: jirkakrepl Date: Wed, 18 Aug 2021 17:32:45 +0200 Subject: [PATCH 2/2] fix: eslint errors --- package/server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/server.js b/package/server.js index dade876..19a2bfe 100644 --- a/package/server.js +++ b/package/server.js @@ -200,10 +200,10 @@ export { start }; onMessage('client-refresh', (options) => { console.log('CLIENT TESTS RESTARTING (client-refresh)', options === undefined ? '' : options); - clientTests() + clientTests(); }); onMessage('webapp-reload-client', (options) => { console.log('CLIENT TESTS RESTARTING (webapp-reload-client)', options === undefined ? '' : options); - clientTests() + clientTests(); });