Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Show passed test results if debug == true #248

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@ module.exports = (opts) => {
// runOpts.margs.argv.framework.indexOf("mocha") > -1;

const debug = runOpts.margs.argv.debug || false;
const showPassedTests = runOpts.margs.argv.show_passed_tests || false;
const useSerialMode = runOpts.margs.argv.serial;
let MAX_TEST_ATTEMPTS = parseInt(runOpts.margs.argv.max_test_attempts) || 3;
let targetProfiles;
@@ -408,6 +409,7 @@ module.exports = (opts) => {

const testRunner = new runOpts.TestRunner(tests, {
debug,
showPassedTests,

maxWorkers: MAX_WORKERS,

5 changes: 5 additions & 0 deletions src/help.js
Original file line number Diff line number Diff line change
@@ -71,6 +71,11 @@ module.exports = {
"visible": true,
"description": "Enable debugging magellan messages (dev mode)."
},
"show_passed_tests": {
"category": "Parallelism, Workflow and Filtering",
"visible": true,
"description": "Show passed tests output."
},
"config": {
"category": "Configuration",
"visible": true,
1 change: 1 addition & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ module.exports = {
environment: env,

debug: argv.debug,
showPassedTests: argv.show_passed_tests,

gatherTrends: argv.gather_trends,

21 changes: 21 additions & 0 deletions src/test_runner.js
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ const FINAL_CLEANUP_DELAY = 2500;
// getEnvironment - function(worker, test) that returns a key value object to use as the
// process environment
// debug - true/false flag for magellan debugging mode
// showPassedTests - true/false flag for magellan show passed tests mode
// onSuccess - function() callback
// onFailure - function(failedTests) callback
// opts: testing options
@@ -69,6 +70,7 @@ class TestRunner {
this.profiles = options.profiles;
this.executors = options.executors;
this.debug = options.debug;
this.showPassedTests = options.showPassedTests;

this.serial = options.serial || false;

@@ -617,6 +619,19 @@ class TestRunner {
}
}

logPassedTests() {
logger.log(clc.greenBright("============= Passed Tests: ============="));

this.passedTests.forEach((passedTest) => {
logger.log("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
logger.log("Passed Test: " + passedTest.toString());
logger.log(" # attempts: " + passedTest.attempts);
logger.log(" output: ");
logger.log(passedTest.stdout);
logger.log(passedTest.stderr);
});
}

logFailedTests() {
logger.log(clc.redBright("============= Failed Tests: ============="));

@@ -639,6 +654,12 @@ class TestRunner {

this.gatherTrends();

if (this.showPassedTests) {
if (this.passedTests.length > 0) {
this.logPassedTests();
}
}

if (this.failedTests.length > 0) {
this.logFailedTests();
}
3 changes: 2 additions & 1 deletion src/worker_allocator.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@ class Allocator {
setTimeout,
checkPorts: portUtil.checkPorts,
getNextPort: portUtil.getNextPort,
debug: settings.debug
debug: settings.debug,
showPassedTests: settings.showPassedTests // Is this needed ?
}, opts);

logger.debug("Worker Allocator starting.");