diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2024-03-15 17:44:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 17:44:05 -0400 |
commit | f80e78ef3e7ded1fc693465d02dfb07510ded0ab (patch) | |
tree | 9dc57820e1acaa25ad6df509a63c4fcf5bc379c5 /test/runner/reporter.js | |
parent | 44fb7fa220e2dc2780203b128df2181853b3300f (diff) | |
download | jquery-f80e78ef3e7ded1fc693465d02dfb07510ded0ab.tar.gz jquery-f80e78ef3e7ded1fc693465d02dfb07510ded0ab.zip |
Tests: show any and all actual/expected values
Close gh-5448
Diffstat (limited to 'test/runner/reporter.js')
-rw-r--r-- | test/runner/reporter.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/runner/reporter.js b/test/runner/reporter.js index 519d74709..c70c6d80c 100644 --- a/test/runner/reporter.js +++ b/test/runner/reporter.js @@ -21,9 +21,11 @@ export function reportTest( test, reportId, { browser, headless } ) { if ( test.errors.length ) { for ( const error of test.errors ) { message += "\n"; - message += `\n${ error.message }`; + if ( error.message ) { + message += `\n${ error.message }`; + } message += `\n${ chalk.gray( error.stack ) }`; - if ( error.expected && error.actual ) { + if ( "expected" in error && "actual" in error ) { message += `\nexpected: ${ JSON.stringify( error.expected ) }`; message += `\nactual: ${ JSON.stringify( error.actual ) }`; let diff; @@ -54,6 +56,13 @@ export function reportTest( test, reportId, { browser, headless } ) { } else { diff = [ { removed: true, value: `${ value }` } ]; } + } else if ( + typeof error.expected === "boolean" && + typeof error.actual === "boolean" + ) { + + // Show the actual boolean in red + diff = [ { removed: true, value: `${ error.actual }` } ]; } else { // Diff everything else as characters |