Skip to content

Commit afac822

Browse files
committed
fix(journey-client,device-client): fix AbortSignal cross-realm failure on Node 24
Node 24 tightened undici's instanceof AbortSignal check. When vitest runs under jsdom, RTK's createAsyncThunk picks up jsdom's AbortController, producing a signal that fails instanceof in native fetch. Switch both store test files to @vitest-environment node. The redirect test that needed window.location.assign is updated to use vi.stubGlobal instead of vi.spyOn so it works without a DOM environment.
1 parent 65c91fa commit afac822

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/device-client/src/lib/device.store.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @vitest-environment node
12
/*
23
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
34
*

packages/journey-client/src/lib/client.store.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @vitest-environment node
12
/*
23
* Copyright (c) 2025 Ping Identity Corporation. All rights reserved.
34
*
@@ -204,10 +205,7 @@ describe('journey-client', () => {
204205
};
205206
const step = createJourneyStep(mockStepPayload);
206207
const assignMock = vi.fn();
207-
const locationSpy = vi.spyOn(window, 'location', 'get').mockReturnValue({
208-
...window.location,
209-
assign: assignMock,
210-
});
208+
vi.stubGlobal('window', { location: { assign: assignMock } });
211209
setupMockFetch();
212210

213211
const client = await journey({ config: mockConfig });
@@ -216,7 +214,7 @@ describe('journey-client', () => {
216214
expect(mockStorageInstance.set).toHaveBeenCalledWith({ step: step.payload });
217215
expect(assignMock).toHaveBeenCalledWith('https://sso.com/redirect');
218216

219-
locationSpy.mockRestore();
217+
vi.unstubAllGlobals();
220218
});
221219

222220
describe('resume()', () => {

0 commit comments

Comments
 (0)