Repository navigation
Improve asserting element equality in tests - #211
Merged
Merged
Conversation
A stuck job would otherwise hold a pull request for GitHub's default of six hours. No job has reached a minute, so 5 minutes means something's stuck, not slow, and the workflow says so, to let the number be questioned later. Closes jzheauxgh-229 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Josh Cummings <[email protected]>
These four checks compared two elements with assert.equal or assert.ok(a === b), so a failure would either hang the run or say nothing. Now they name both elements, as the rest do. Closes jzheauxgh-167 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Josh Cummings <[email protected]>
jzheaux
force-pushed
the
fix/167-element-asserts
branch
from
November 3, 2026 06:59
309afa3 to
b439238
Compare
Owner
|
Thank you, @Ptraaah, for these careful changes! They are now merged into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #167.
test/dom.jsgainsassertElementandassertNotElement. They compare elements by identity and fail at once, naming each element by its tag, id and classes, so a failing check says what was expected and what was there instead of describing the whole element for its message. Every element assert in the suite moves onto them (48 call sites): theassert.equalandassert.notEqualones ondocument.activeElement, and theassert.ok(a === b)/!==workarounds, keeping their messages. CI's test job getstimeout-minutes: 10, so a hang can't hold a run for hours.What I ran locally:
assert.equal(document.activeElement, document.body)with the keyboard on a button took 17.7 seconds to fail, all of it spent describing the button. The same check throughassertElementfails in milliseconds:expected body, got button#sidebarToggle.ghost.icon.test/focus.test.js, I pointed one assert at the wrong element and ran the file. It failed in seconds withexpected button#newBtn.ghost.small, got input#newName. Put back afterwards.npm testbefore the change: 777 tests, 775 pass, 1 skipped, and one failure intest/cli.test.js(a frame-port test, unrelated to this; it passed on the after run). After: 777 tests, 776 pass, 0 fail, 1 skipped. Lint is clean on the touched files.