Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@Krinkle
Copy link
Member

@Krinkle Krinkle commented Aug 7, 2024

pushFailure

This was setting actual: null and, left expected unset/undefined. In HtmlReporter this idom was recognised to mean "don't show values", based on hasOwn for expected. This worked because QUnit.log() passes the internal assert result object as-is.

In TAP output, this was not skipped because Test.js#logAssertion copies the object for the testEnd.errors array, and in doing so forges an expected property to exist no matter what, thus with an implied value of undefined. The hasOwn checks in TapReporter thus always evaluate to true.

This meant TAP output for pushFailure() calls not only showed redundant actual/expected entries, but actively created confusion by setting them to different values, drawing attention to a supposed difference that has no meaning

actual: null
expected: undefined

Fix by changing pushFailure to omit both actual and expected, and change the condition in both reporters to skip rendering of values based on both being strictly equal to undefined, instead of based on hasOwn('expected').

Before:

TAP version 13
not ok 1 example
  ---
  message: Expected 2 assertions, but 1 were run
  severity: failed
  actual  : null
  expected: undefined
  stack: |
        at /test/example.test.js:1:7

After:

TAP version 13
not ok 1 example
  ---
  message: Expected 2 assertions, but 1 were run
  severity: failed
  stack: |
        at /test/example.test.js:1:7

onUncaughtException / QUnit.on('error')

For uncaught errors, we already omitted both actual and undefined, the HtmlReporter thus already skipped them (for the reason above), but in TAP output they showed, for the same reason as above as:

actual: undefined
expected: undefined

Which, while not as actively confusing, is at least redundant. This is naturally fixed by the same change, which now omits this.

Before:

TAP version 13
Bail out! Error: boo example
  ---
  message: Error: boo example
  severity: failed
  actual  : undefined
  expected: undefined
  stack: |
        at /test.js:3:7
  ...

After:

TAP version 13
Bail out! Error: boo example
  ---
  message: Error: boo example
  severity: failed
  stack: |
        at /test.js:3:7
  ...

== pushFailure ==

This was setting `actual: null` and, left expected unset/undefined.
In HtmlReporter this idom was recognised to mean "don't show values",
based on hasOwn for `expected`. This worked because QUnit.log() passes
the internal assert result object as-is.

In TAP output, this was not skipped because Test.js#logAssertion
copies the object for the testEnd.errors array, and in doing so forges
an `expected` property to exist no matter what, thus with an implied
value of undefined. The hasOwn checks in TapReporter thus always
evaluate to true.

This meant TAP output for pushFailure() calls not only showed
redundant actual/expected entries, but actively created confusion
by setting them to different values, drawing attention to a supposed
difference that has no meaning

> actual: null
> expected: undefined

Fix by changing pushFailure to omit both actual and expected,
and change the condition in both reporters to skip rendering of values
based on both being strictly equal to `undefined`, instead of based
on `hasOwn('expected')`.

== onUncaughtException / `QUnit.on('error')` ==

For uncaught errors, we already omitted both actual and undefined,
the HtmlReporter thus already skipped them (for the reason above),
but in TAP output they showed, for the same reason as above as:

> actual: undefined
> expected: undefined

Which, while not as actively confusing, is at least redundant.
This is naturally fixed by the same change, which now omits this.
@Krinkle
Copy link
Member Author

Krinkle commented Aug 7, 2024

Cross-ref #1789 (thematically related: polishing CLI/TAP output)

@Krinkle Krinkle added this to the 3.0 release milestone Aug 7, 2024
@Krinkle Krinkle merged commit 9a1fc05 into main Aug 7, 2024
@Krinkle Krinkle deleted the cli-trace-cleaner branch August 7, 2024 22:57
Krinkle added a commit that referenced this pull request Dec 4, 2024
Cherry-picked from 9a1fc05 (3.0.0-dev).

This also includes a partial cherry-pick of 0f7aeac (3.0.0-dev),
which removes an unused `actual` argument from the pushFailure
function.

Ref #1794.
Krinkle added a commit that referenced this pull request Dec 4, 2024
Cherry-picked from 9a1fc05 (3.0.0-dev).

This also includes a partial cherry-pick of 0f7aeac (3.0.0-dev),
which removes an unused `actual` argument from the pushFailure
function.

Ref #1794.
@Krinkle Krinkle modified the milestones: 3.0 release, 2.x release Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.