MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / runGCTests

Function runGCTests

test/testUtil.js:16–50  ·  view source on GitHub ↗
(tests)

Source from the content-addressed store, hash-verified

14}
15
16async function runGCTests (tests) {
17 // Break up test list into a list of lists of the form
18 // [ [ 'test name', function() {}, ... ], ..., ].
19 const testList = [];
20 let currentTest;
21 for (const item of tests) {
22 if (typeof item === 'string') {
23 currentTest = [];
24 testList.push(currentTest);
25 }
26 currentTest.push(item);
27 }
28
29 for (const test of testList) {
30 await (async function (test) {
31 let title;
32 for (let i = 0; i < test.length; i++) {
33 if (i === 0) {
34 title = test[i];
35 } else {
36 try {
37 test[i]();
38 } catch (e) {
39 console.error('Test failed: ' + title);
40 throw e;
41 }
42 if (i < tests.length - 1) {
43 global.gc();
44 await tick(10);
45 }
46 }
47 }
48 })(test);
49 }
50}
51
52module.exports = {
53 runGCTests

Callers

nothing calls this directly

Calls 1

tickFunction · 0.85

Tested by

no test coverage detected