Fix Jest test failures caused by Node 24 / jsdom incompatibilities#6826
Open
cliftonmcintosh wants to merge 2 commits intorubyforgood:mainfrom
Open
Fix Jest test failures caused by Node 24 / jsdom incompatibilities#6826cliftonmcintosh wants to merge 2 commits intorubyforgood:mainfrom
cliftonmcintosh wants to merge 2 commits intorubyforgood:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
|
This fixes the lint failures that are occurring in some of the other PRs, including my case contact table PR. |
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.
What github issue is this PR for, if any?
Resolves #6825
What changed, and why?
Updated two Jest test files to be compatible with Node 24 and newer versions of jsdom. No production code was changed.
app/javascript/__tests__/two_minute_warning_session_timeout.test.jsReplaced
Object.defineProperty(window, 'location', { writable: true, value: ... })withdelete window.locationfollowed by a plain assignment. Newer versions of jsdom definelocationas non-configurable, causing the previous approach to throwTypeError: Cannot redefine property: location.app/javascript/__tests__/validated_form.test.jsUpdated assertions comparing CSS border values from
'2px solid #ffc107'to'2px solid rgb(255, 193, 7)'. Newer versions of jsdom normalize CSS color values torgb()notation when reading them back via jQuery's.css().How is this tested? (please write rspec and jest tests!) 💖💪
The two previously failing test suites now pass: