MCPcopy Index your code
hub / github.com/nodejs/node / runGCTests

Function runGCTests

test/js-native-api/test_general/test.js:83–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81assert(adjustedValue > 0);
82
83async function runGCTests() {
84 // Ensure that garbage collecting an object with a wrapped native item results
85 // in the finalize callback being called.
86 assert.strictEqual(test_general.derefItemWasCalled(), false);
87
88 (() => test_general.wrap({}))();
89 await gcUntil('deref_item() was called upon garbage collecting a ' +
90 'wrapped object.',
91 () => test_general.derefItemWasCalled());
92
93 // Ensure that removing a wrap and garbage collecting does not fire the
94 // finalize callback.
95 let z = {};
96 test_general.testFinalizeWrap(z);
97 test_general.removeWrap(z);
98 z = null;
99 await gcUntil(
100 'finalize callback was not called upon garbage collection.',
101 () => (!test_general.finalizeWasCalled()));
102}
103runGCTests();

Callers 1

test.jsFile · 0.70

Calls 2

gcUntilFunction · 0.85
wrapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…