Skip to content

Commit d4b6520

Browse files
committed
test(elysia): move vi.unstubAllGlobals to afterEach
Per review feedback: unstubbing inline at the end of the test means it is skipped if an assertion above it fails, leaking the stubbed `Bun` global into later tests. Move it into the existing `afterEach` so cleanup always runs.
1 parent a46b72e commit d4b6520

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎packages/elysia/test/sdk.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const { init, getDefaultIntegrations } = await import('../src/sdk');
2929
describe('init', () => {
3030
afterEach(() => {
3131
vi.clearAllMocks();
32+
vi.unstubAllGlobals();
3233
});
3334

3435
it('sets SDK metadata to elysia', () => {
@@ -117,8 +118,6 @@ describe('init', () => {
117118
const calledOptions = mockInitNode.mock.calls[0]![0];
118119
expect(calledOptions.runtime).toEqual({ name: 'bun', version: '1.2.3' });
119120
expect(mockApplySdkMetadata).toHaveBeenCalledWith(expect.anything(), 'elysia', ['elysia', 'bun']);
120-
121-
vi.unstubAllGlobals();
122121
});
123122
});
124123

0 commit comments

Comments
 (0)