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

Function test

test/error_terminating_environment.js:78–98  ·  view source on GitHub ↗
(bindingPath, processShouldAbort)

Source from the content-addressed store, hash-verified

76 }
77
78 function test (bindingPath, processShouldAbort) {
79 const numberOfTestCases = 5;
80
81 for (let i = 0; i < numberOfTestCases; ++i) {
82 const childProcess = require('./napi_child').spawnSync(
83 process.execPath,
84 [
85 __filename,
86 'runInChildProcess',
87 bindingPath,
88 i
89 ]
90 );
91
92 if (processShouldAbort) {
93 assert(childProcess.status !== 0, `Test case ${bindingPath} ${i} failed: Process exited with status code 0.`);
94 } else {
95 assert(childProcess.status === 0, `Test case ${bindingPath} ${i} failed: Process status ${childProcess.status} is non-zero`);
96 }
97 }
98 }
99}

Callers 1

wrapTestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected