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

Function checkOutput

test/common/child_process.js:45–61  ·  view source on GitHub ↗
(str, check)

Source from the content-addressed store, hash-verified

43}
44
45function checkOutput(str, check) {
46 if ((check instanceof RegExp && !check.test(str)) ||
47 (typeof check === 'string' && check !== str)) {
48 return { passed: false, reason: `did not match ${util.inspect(check)}` };
49 }
50 if (typeof check === 'function') {
51 try {
52 check(str);
53 } catch (error) {
54 return {
55 passed: false,
56 reason: `did not match expectation, checker throws:\n${util.inspect(error)}`,
57 };
58 }
59 }
60 return { passed: true };
61}
62
63function expectSyncExit(caller, spawnArgs, {
64 status,

Callers 1

expectSyncExitFunction · 0.70

Calls 3

inspectMethod · 0.80
checkFunction · 0.70
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…