Skip to content

Commit f80e78e

Browse files
authored
Tests: show any and all actual/expected values
Close gh-5448
1 parent 44fb7fa commit f80e78e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/runner/reporter.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ export function reportTest( test, reportId, { browser, headless } ) {
2121
if ( test.errors.length ) {
2222
for ( const error of test.errors ) {
2323
message += "\n";
24-
message += `\n${ error.message }`;
24+
if ( error.message ) {
25+
message += `\n${ error.message }`;
26+
}
2527
message += `\n${ chalk.gray( error.stack ) }`;
26-
if ( error.expected && error.actual ) {
28+
if ( "expected" in error && "actual" in error ) {
2729
message += `\nexpected: ${ JSON.stringify( error.expected ) }`;
2830
message += `\nactual: ${ JSON.stringify( error.actual ) }`;
2931
let diff;
@@ -54,6 +56,13 @@ export function reportTest( test, reportId, { browser, headless } ) {
5456
} else {
5557
diff = [ { removed: true, value: `${ value }` } ];
5658
}
59+
} else if (
60+
typeof error.expected === "boolean" &&
61+
typeof error.actual === "boolean"
62+
) {
63+
64+
// Show the actual boolean in red
65+
diff = [ { removed: true, value: `${ error.actual }` } ];
5766
} else {
5867

5968
// Diff everything else as characters

0 commit comments

Comments
 (0)