Skip to content
Snippets Groups Projects
Commit 3563356a authored by michael.minelli's avatar michael.minelli
Browse files

ExerciseRunHelper => Update log function & display results

parent 7279e8fa
No related branches found
No related tags found
No related merge requests found
...@@ -89,10 +89,10 @@ class ExerciseRunHelper { ...@@ -89,10 +89,10 @@ class ExerciseRunHelper {
const validationResults = SharedAssignmentHelper.validateDescriptionFile(path.join(options.path, ClientsSharedConfig.assignment.filename)); const validationResults = SharedAssignmentHelper.validateDescriptionFile(path.join(options.path, ClientsSharedConfig.assignment.filename));
if ( !validationResults.isValid ) { if ( !validationResults.isValid ) {
spinner.fail(`The ${ ClientsSharedConfig.assignment.filename } file is invalid: ${ JSON.stringify(validationResults.errors) }`); spinner.fail(`The ${ ClientsSharedConfig.assignment.filename } file is invalid: ${ validationResults.error }`);
return; return;
} else { } else {
assignmentFile = validationResults.results!; assignmentFile = validationResults.content!;
} }
haveResultsVolume = assignmentFile.result.volume !== undefined; haveResultsVolume = assignmentFile.result.volume !== undefined;
...@@ -139,14 +139,18 @@ class ExerciseRunHelper { ...@@ -139,14 +139,18 @@ class ExerciseRunHelper {
let spinner: ora.Ora; let spinner: ora.Ora;
if ( verbose ) { if ( verbose ) {
let buildPhase: boolean = true; let buildPhase: boolean | undefined = undefined;
exerciseDockerCompose.events.on('logs', (log: string, _error: boolean, displayable: boolean, currentStep: string) => { exerciseDockerCompose.events.on('logs', (log: string, _error: boolean, displayable: boolean, currentStep: string) => {
for ( const line of log.split('\n') ) { for ( const line of log.split('\n') ) {
if ( currentStep == 'COMPOSE_RUN' && buildPhase && line != '' && !line.startsWith('#') ) { if ( displayable && buildPhase == undefined && line.startsWith('#') ) {
buildPhase = true;
}
if ( currentStep == 'COMPOSE_RUN' && buildPhase === true && line != '' && !line.startsWith('#') ) {
buildPhase = false; buildPhase = false;
} }
if ( displayable && (options.superVerbose || !buildPhase) ) { if ( displayable && (options.superVerbose || buildPhase === false) ) {
console.log(line); console.log(line);
} }
} }
...@@ -248,11 +252,12 @@ class ExerciseRunHelper { ...@@ -248,11 +252,12 @@ class ExerciseRunHelper {
// Step 4: Display results + Volume location // Step 4: Display results + Volume location
{ {
const info = chalk.magenta.bold.italic;
ClientsSharedExerciseHelper.displayExecutionResults(exerciseResultsValidation.exerciseResults!, exerciseDockerCompose.exitCode, { ClientsSharedExerciseHelper.displayExecutionResults(exerciseResultsValidation.exerciseResults!, exerciseDockerCompose.exitCode, {
INFO : chalk.bold, INFO : info,
SUCCESS: chalk.green, SUCCESS: chalk.green,
FAILURE: chalk.red FAILURE: chalk.red
}, `\n\n${ chalk.bold('Execution results folder') } : ${ this.folderResultsVolume }`); }, `\n\n${ info('Execution results folder: ') }${ this.folderResultsVolume }`);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment