Skip to content

Commit

Permalink
Merge pull request #18 from PrimeAcademy/DoctorHowser-patch-1
Browse files Browse the repository at this point in the history
Update reporter.js
  • Loading branch information
DoctorHowser authored Apr 25, 2024
2 parents 86ccdc1 + dd1511d commit 1540b26
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,48 @@ const {

// Custom output to match our rubric
class MyReporter {
_logger = console.log // So that we always have something to log with
constructor(runner) {
const stats = runner.stats;
const errors = [];
runner
.on(EVENT_TEST_FAIL, (test, err) => {
errors.push(err);
console.log(
this._logger(
`\x1b[31m`,
`| ${test.parent.title} | no, see note ${errors.length} |`,
`\x1b[0m`
);
// console.log(test)
})
.on(EVENT_TEST_PASS, (test, err) => {
console.log(
this._logger(
`\x1b[32m`,
`| ${test.parent.title} | yes |`,
`\x1b[0m`
);
})
.once(EVENT_RUN_BEGIN, () => {
console.log('');
console.log(`---
this._logger('');
this._logger(`---
| Part 3 - Cart System | Complete? |
| --- | :---: |`);
console.log(
this._logger(
`\x1b[32m`,
`| Runs in browser without console errors | yes |`,
`\x1b[0m`
);
})
.once(EVENT_RUN_END, () => {
console.log('');
this._logger('');
// console.log(`end: ${stats.passes}/${stats.passes + stats.failures} ok`);

errors.map((err, i) => {
console.log('');
console.log(`${i + 1}) ${err}`);
this._logger('');
this._logger(`${i + 1}) ${err}`);
});
});
}
}

module.exports = MyReporter;
module.exports = MyReporter;

0 comments on commit 1540b26

Please sign in to comment.