Two Jest test suites are currently failing in CI due to incompatibilities with newer versions of Node and jsdom. The production code is correct in both cases — only the tests need updating. See this CI run for an example.
validated_form.test.js (2 failures)
The tests assert that a CSS border value equals '2px solid #ffc107'. Newer versions of jsdom normalize CSS color values to rgb() notation when reading them back via jQuery's .css(), so the actual value returned is '2px solid rgb(255, 193, 7)'. The fix is to update the two assertions to match the normalized format.
two_minute_warning_session_timeout.test.js (1 failure)
The test mocks window.location using Object.defineProperty(window, 'location', { writable: true, value: ... }). Newer versions of jsdom define location as non-configurable, causing this to throw TypeError: Cannot redefine property: location. The fix is to replace that pattern with delete window.location followed by a plain assignment, which is the modern jsdom-compatible approach.
Steps to reproduce
npx jest app/javascript/__tests__/validated_form.test.js app/javascript/__tests__/two_minute_warning_session_timeout.test.js
Both suites fail on main with Node 24.
Two Jest test suites are currently failing in CI due to incompatibilities with newer versions of Node and jsdom. The production code is correct in both cases — only the tests need updating. See this CI run for an example.
validated_form.test.js(2 failures)The tests assert that a CSS border value equals
'2px solid #ffc107'. Newer versions of jsdom normalize CSS color values torgb()notation when reading them back via jQuery's.css(), so the actual value returned is'2px solid rgb(255, 193, 7)'. The fix is to update the two assertions to match the normalized format.two_minute_warning_session_timeout.test.js(1 failure)The test mocks
window.locationusingObject.defineProperty(window, 'location', { writable: true, value: ... }). Newer versions of jsdom definelocationas non-configurable, causing this to throwTypeError: Cannot redefine property: location. The fix is to replace that pattern withdelete window.locationfollowed by a plain assignment, which is the modern jsdom-compatible approach.Steps to reproduce
Both suites fail on
mainwith Node 24.