mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #13078 from meteor/making-ci-better-for-3.0
[Meteor 3.0] Making our CI more easy to understand
This commit is contained in:
@@ -5,12 +5,29 @@ let testNumber = 0;
|
||||
async function runNextUrl(browser) {
|
||||
const page = await browser.newPage();
|
||||
|
||||
page.on('console', msg => {
|
||||
page.on('console', async msg => {
|
||||
// this is a way to make sure the travis does not timeout
|
||||
// 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 console.log(`Test number: ${ testNumber }`);
|
||||
testNumber++;
|
||||
else {
|
||||
testNumber++;
|
||||
const currentClientTest =
|
||||
await page.evaluate(() => __Tinytest._getCurrentRunningTestOnClient());
|
||||
if (currentClientTest !== '') {
|
||||
console.log(`Currently running on the client test: ${ currentClientTest }`)
|
||||
return;
|
||||
}
|
||||
// If we get here is because we have not yet started the test on the client
|
||||
const currentServerTest =
|
||||
await page.evaluate(async () => await __Tinytest._getCurrentRunningTestOnServer());
|
||||
|
||||
if (currentServerTest !== '') {
|
||||
console.log(`Currently running on the server test: ${ currentServerTest }`);
|
||||
return;
|
||||
}
|
||||
// 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 }`);
|
||||
}
|
||||
});
|
||||
|
||||
if (!process.env.URL) {
|
||||
@@ -23,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) {
|
||||
|
||||
@@ -531,6 +531,7 @@ export class TestRun {
|
||||
|
||||
_runTest(test, onComplete, stop_at_offset) {
|
||||
var startTime = (+new Date);
|
||||
Tinytest._currentRunningTestName = test.name;
|
||||
|
||||
return test.run(event => {
|
||||
/* onEvent */
|
||||
@@ -671,6 +672,7 @@ export class TestRun {
|
||||
/******************************************************************************/
|
||||
|
||||
export const Tinytest = {};
|
||||
globalThis.__Tinytest = Tinytest;
|
||||
|
||||
Tinytest.addAsync = function (name, func, options) {
|
||||
TestManager.addCase(new TestCase(name, func), options);
|
||||
@@ -701,6 +703,22 @@ Tinytest._runTests = function (onReport, onComplete, pathPrefix) {
|
||||
testRun.run(onComplete);
|
||||
};
|
||||
|
||||
Tinytest._currentRunningTestName = ""
|
||||
|
||||
Meteor.methods({
|
||||
'tinytest/getCurrentRunningTestName'() {
|
||||
return Tinytest._currentRunningTestName;
|
||||
}
|
||||
})
|
||||
|
||||
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
|
||||
// failure event output by _runTests.
|
||||
|
||||
Reference in New Issue
Block a user