diff --git a/packages/ddp-server/livedata_server_async_tests.js b/packages/ddp-server/livedata_server_async_tests.js index d145aeee92..83b029debd 100644 --- a/packages/ddp-server/livedata_server_async_tests.js +++ b/packages/ddp-server/livedata_server_async_tests.js @@ -99,7 +99,7 @@ Meteor.publish({ async publicationObjectAsync() { await sleep(50); let callback = onSubscriptions; - if (callback) callback(); + if (callback) callback("publicationObjectAsync"); this.stop(); }, }); @@ -108,7 +108,7 @@ Meteor.publish({ publication_object_async: async function() { await sleep(50); let callback = onSubscriptions; - if (callback) callback(); + if (callback) callback("publication_object_async"); this.stop(); }, }); @@ -116,7 +116,7 @@ Meteor.publish({ Meteor.publish('publication_compatibility_async', async function() { await sleep(50); let callback = onSubscriptions; - if (callback) callback(); + if (callback) callback("publication_compatibility_async"); this.stop(); }); @@ -128,10 +128,12 @@ Tinytest.addAsync('livedata server - async publish object', function( let testsLength = 0; onSubscriptions = function(subscription) { - delete onSubscriptions; - clientConn.disconnect(); + // for debugging + // console.log('subscription is ok:', subscription) testsLength++; - if (testsLength == 3) { + delete onSubscriptions; + if (testsLength === 3) { + clientConn.disconnect(); onComplete(); } }; diff --git a/packages/test-in-console/driver.js b/packages/test-in-console/driver.js index 7b8711ad75..95904e20c5 100644 --- a/packages/test-in-console/driver.js +++ b/packages/test-in-console/driver.js @@ -1,7 +1,7 @@ // Global flag for phantomjs (or other browser) to eval to see if we're done. DONE = false; // Failure count for phantomjs exit code -FAILURES = null; +FAILURES = 0; // Where are the failures WHERE_FAILED = []; // Passed count for phantomjs exit code @@ -9,7 +9,7 @@ PASSED = null; TEST_STATUS = { DONE: false, - FAILURES: null, + FAILURES: 0, PASSED: null, WHERE_FAILED: [] }; @@ -149,6 +149,7 @@ runTests = function () { else log("Test failed with exception"); failed++; + whereFailed.push({ name: name, info: JSON.stringify(event) }); break; case "finish": switch (resultSet[name].status) { diff --git a/packages/test-in-console/puppeteerRunner.js b/packages/test-in-console/puppeteerRunner.js index bdff436e5b..f4735106c1 100644 --- a/packages/test-in-console/puppeteerRunner.js +++ b/packages/test-in-console/puppeteerRunner.js @@ -29,7 +29,7 @@ async function runNextUrl(browser) { 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) { + if (failCount > 0) { const failed = await getFailed(page); failed.map((f) => console.log(`${ f.name } failed: ${ f.info }`)); await page.close(); @@ -89,11 +89,7 @@ async function getFailCount(page) { return TEST_STATUS.FAILURES; } - if (typeof FAILURES === 'undefined') { - return 1; - } - - return 0; + return typeof FAILURES !== 'undefined' && FAILURES; }); }