Skip to content

Commit

Permalink
mock out getHeapSnapshot in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 14, 2023
1 parent 5aa7472 commit 1a66d78
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/jest-leak-detector/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

import LeakDetector from '../index';

jest.mock('v8', () => ({
...(jest.requireActual('v8') as Record<string, unknown>),
getHeapSnapshot: jest.fn(),
}));

const gc = globalThis.gc;

// Some tests override the "gc" value. Let's make sure we roll it back to its
Expand Down

0 comments on commit 1a66d78

Please sign in to comment.