diff --git a/packages/test-in-console/puppeteerRunner.js b/packages/test-in-console/puppeteerRunner.js index 3181b06bc3..d0a59ae9c9 100644 --- a/packages/test-in-console/puppeteerRunner.js +++ b/packages/test-in-console/puppeteerRunner.js @@ -10,11 +10,10 @@ async function runNextUrl(browser) { // if the test is running for too long without any output to the console (10 minutes) if (msg._text !== undefined) console.log(msg._text); else { - // sometimes if the test is running in the client we have id: current-client-test with - // the name of the test - const element = await page.$('#current-client-test'); - if (element) { - const currentClientTest = await page.evaluate(element => element.textContent, element); + testNumber++; + const currentClientTest = + await page.evaluate(() => __Tinytest._getCurrentRunningTestOnClient()); + if (currentClientTest !== '') { console.log(`Currently running on the client test: ${ currentClientTest }`) return; } @@ -29,7 +28,6 @@ async function runNextUrl(browser) { // we were not able to find the name of the test, this is a way to make sure the test is still running console.log(`Test number: ${ testNumber }`); } - testNumber++; }); if (!process.env.URL) { @@ -42,10 +40,6 @@ async function runNextUrl(browser) { async function poll() { if (await isDone(page)) { let failCount = await getFailCount(page); - console.log(` - The number of tests from Test number may be different because - of the way the test is written. causing the test to fail or - to run more than once. in the console. Test number total: ${ testNumber }`); console.log(`Tests complete with ${ failCount } failures`); console.log(`Tests complete with ${ await getPassCount(page) } passes`); if (failCount > 0) { diff --git a/packages/tinytest/tinytest.js b/packages/tinytest/tinytest.js index 5bae48ea57..3427db1c86 100644 --- a/packages/tinytest/tinytest.js +++ b/packages/tinytest/tinytest.js @@ -531,9 +531,7 @@ export class TestRun { _runTest(test, onComplete, stop_at_offset) { var startTime = (+new Date); - if (Meteor.isServer){ - Tinytest._currentRunningTestNameOnServer = test.name; - } + Tinytest._currentRunningTestName = test.name; return test.run(event => { /* onEvent */ @@ -705,19 +703,21 @@ Tinytest._runTests = function (onReport, onComplete, pathPrefix) { testRun.run(onComplete); }; -Tinytest._currentRunningTestNameOnServer = "" +Tinytest._currentRunningTestName = "" Meteor.methods({ 'tinytest/getCurrentRunningTestName'() { - return Tinytest._currentRunningTestNameOnServer; + return Tinytest._currentRunningTestName; } }) -// Get current running test from server; Tinytest._getCurrentRunningTestOnServer = function () { return Meteor.callAsync('tinytest/getCurrentRunningTestName'); } +Tinytest._getCurrentRunningTestOnClient = function () { + return Tinytest._currentRunningTestName; +} // Run just one test case, and stop the debugger at a particular // error, all as indicated by 'cookie', which will have come from a