Skip to content

Commit

Permalink
test_runner: adding colors to the xs and dots in the test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni committed Jun 15, 2024
1 parent 2e1f772 commit 46a5fce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/internal/test_runner/reporter/dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ const {
ArrayPrototypePush,
MathMax,
} = primordials;
const colors = require('internal/util/colors');
const { formatTestReport } = require('internal/test_runner/reporter/utils');
const { red, white, green, clear } = require('internal/util/colors');

module.exports = async function* dot(source) {
let count = 0;
let columns = getLineLength();
const failedTests = [];
for await (const { type, data } of source) {
if (type === 'test:pass') {
yield '.';
yield `${green}.${clear}`;
}
if (type === 'test:fail') {
yield 'X';
yield `${red}X${clear}`;
ArrayPrototypePush(failedTests, data);
}
if ((type === 'test:fail' || type === 'test:pass') && ++count === columns) {
Expand All @@ -28,7 +28,7 @@ module.exports = async function* dot(source) {
}
yield '\n';
if (failedTests.length > 0) {
yield `\n${colors.red}Failed tests:${colors.white}\n\n`;
yield `\n${red}Failed tests:${white}\n\n`;
for (const test of failedTests) {
yield formatTestReport('test:fail', test);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
..............................
.........................................
.............................
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c

0 comments on commit 46a5fce

Please sign in to comment.