Skip to content

Commit 1a66d78

Browse files
committed
mock out getHeapSnapshot in unit test
1 parent 5aa7472 commit 1a66d78

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/jest-leak-detector/src/__tests__/index.test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
import LeakDetector from '../index';
99

10+
jest.mock('v8', () => ({
11+
...(jest.requireActual('v8') as Record<string, unknown>),
12+
getHeapSnapshot: jest.fn(),
13+
}));
14+
1015
const gc = globalThis.gc;
1116

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

0 commit comments

Comments
 (0)