MCPcopy
hub / github.com/jestjs/jest / runGC

Function runGC

packages/jest-core/src/collectHandles.ts:47–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46let gcFunc: (() => void) | undefined = (globalThis as any).gc;
47function runGC() {
48 if (!gcFunc) {
49 v8.setFlagsFromString('--expose-gc');
50 gcFunc = vm.runInNewContext('gc');
51 v8.setFlagsFromString('--no-expose-gc');
52 if (!gcFunc) {
53 throw new Error(
54 'Cannot find `global.gc` function. Please run node with `--expose-gc` and report this issue in jest repo.',
55 );
56 }
57 }
58
59 gcFunc();
60}
61
62// Inspired by https://github.com/mafintosh/why-is-node-running/blob/master/index.js
63// Extracted as we want to format the result ourselves

Callers 1

collectHandlesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected