Commit c3eaa46
authored
chore: updating test files to not break when node is in v24 (#1434)
Node v24 makes `os.platform` immutable which causes the `spyOn` to fail.
<!-- CURSOR_SUMMARY -->
---
> [!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 with `jest.spyOn`.
>
> Both test files now **`jest.mock('os')`** with `jest.fn()` stand-ins
for the `os` methods under test, **`beforeEach`** restores real
implementations for tests that use the live OS, and the mock-data suites
set **`mockReturnValue`** instead of spies. Mock suites also add
**`afterEach(jest.clearAllMocks)`**. Production SDK code is unchanged.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4828bca. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 2c55f5b commit c3eaa46
2 files changed
Lines changed: 50 additions & 22 deletions
File tree
- packages/sdk
- electron/__tests__/platform
- server-node/__tests__/platform
Lines changed: 25 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
5 | 22 | | |
6 | 23 | | |
7 | 24 | | |
| |||
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | | - | |
45 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
46 | 62 | | |
47 | 63 | | |
48 | 64 | | |
| |||
65 | 81 | | |
66 | 82 | | |
67 | 83 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 84 | + | |
71 | 85 | | |
72 | 86 | | |
73 | 87 | | |
| |||
Lines changed: 25 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
5 | 22 | | |
6 | 23 | | |
7 | 24 | | |
| |||
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | | - | |
45 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
46 | 62 | | |
47 | 63 | | |
48 | 64 | | |
| |||
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 83 | + | |
70 | 84 | | |
71 | 85 | | |
72 | 86 | | |
| |||
0 commit comments