chore: updating test files to not break when node is in v24#1434
chore: updating test files to not break when node is in v24#1434joker23 wants to merge 1 commit into
Conversation
Node v24 makes `os.platform` immutable which causes the `spyOn` to fail.
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4828bca. Configure here.
Node v24 makes
os.platformimmutable which causes thespyOnto fail.Note
Low Risk
Test-only changes with no production code paths affected.
Overview
Updates Electron and server-node platform info tests so they run on Node v24, where
os.platform(and related APIs) are no longer spyable withjest.spyOn.Both test files now
jest.mock('os')withjest.fn()stand-ins for theosmethods under test,beforeEachrestores real implementations for tests that use the live OS, and the mock-data suites setmockReturnValueinstead of spies. Mock suites also addafterEach(jest.clearAllMocks). Production SDK code is unchanged.Reviewed by Cursor Bugbot for commit 4828bca. Bugbot is set up for automated code reviews on this repo. Configure here.