Skip to content
Closed
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions lib/internal/test_runner/reporter/dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = async function* dot(source) {
let count = 0;
let columns = getLineLength();
const failedTests = [];
const diagnosticErrors = [];
for await (const { type, data } of source) {
if (type === 'test:pass') {
yield `${colors.green}.${colors.reset}`;
Expand All @@ -18,6 +19,9 @@ module.exports = async function* dot(source) {
yield `${colors.red}X${colors.reset}`;
ArrayPrototypePush(failedTests, data);
}
if (type === 'test:diagnostic' && data.level === 'error') {
ArrayPrototypePush(diagnosticErrors, data.message);
}
Comment on lines +22 to +24

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to yield in place?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dot reporter is designed to be minimal — yielding diagnostic errors inline would break the dot grid alignment mid-run. This is the same pattern used by failedTests, which also collects and displays at the end rather than yielding inline. Keeping the output clean during the run, then showing errors after, is consistent with the dot reporter's philosophy.

if ((type === 'test:fail' || type === 'test:pass') && ++count === columns) {
yield '\n';

Expand All @@ -33,6 +37,12 @@ module.exports = async function* dot(source) {
yield formatTestReport('test:fail', test);
}
}
if (diagnosticErrors.length > 0) {
yield `\n${colors.red}Diagnostic errors:${colors.white}\n\n`;
for (const msg of diagnosticErrors) {
yield `${msg}\n`;
}
}
};

function getLineLength() {
Expand Down
Loading