|
| 1 | +diff --git a/node_modules/jest-leak-detector/build/index.js b/node_modules/jest-leak-detector/build/index.js |
| 2 | +index a8ccb1e..70699fd 100644 |
| 3 | +--- a/node_modules/jest-leak-detector/build/index.js |
| 4 | ++++ b/node_modules/jest-leak-detector/build/index.js |
| 5 | +@@ -74,26 +74,14 @@ class LeakDetector { |
| 6 | + value = null; |
| 7 | + } |
| 8 | + async isLeaking() { |
| 9 | +- this._runGarbageCollector(); |
| 10 | ++ (0, _v().setFlagsFromString)('--allow-natives-syntax'); |
| 11 | + |
| 12 | + // wait some ticks to allow GC to run properly, see https://github.com/nodejs/node/issues/34636#issuecomment-669366235 |
| 13 | + for (let i = 0; i < 10; i++) { |
| 14 | ++ eval('%CollectGarbage(true)'); |
| 15 | + await tick(); |
| 16 | + } |
| 17 | + return this._isReferenceBeingHeld; |
| 18 | + } |
| 19 | +- _runGarbageCollector() { |
| 20 | +- // @ts-expect-error: not a function on `globalThis` |
| 21 | +- const isGarbageCollectorHidden = globalThis.gc == null; |
| 22 | +- |
| 23 | +- // GC is usually hidden, so we have to expose it before running. |
| 24 | +- (0, _v().setFlagsFromString)('--expose-gc'); |
| 25 | +- (0, _vm().runInNewContext)('gc')(); |
| 26 | +- |
| 27 | +- // The GC was not initially exposed, so let's hide it again. |
| 28 | +- if (isGarbageCollectorHidden) { |
| 29 | +- (0, _v().setFlagsFromString)('--no-expose-gc'); |
| 30 | +- } |
| 31 | +- } |
| 32 | + } |
| 33 | + exports.default = LeakDetector; |
0 commit comments