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

Function loadTestModules

test/index.js:56–90  ·  view source on GitHub ↗
(currentDirectory = __dirname, pre = '')

Source from the content-addressed store, hash-verified

54// TODO(RaisinTen): Update this when the test filenames
55// are changed into test_*.js.
56function loadTestModules (currentDirectory = __dirname, pre = '') {
57 fs.readdirSync(currentDirectory).forEach((file) => {
58 if (currentDirectory === __dirname && (
59 file === 'binding.cc' ||
60 file === 'binding.gyp' ||
61 file === 'build' ||
62 file === 'common' ||
63 file === 'child_processes' ||
64 file === 'napi_child.js' ||
65 file === 'testUtil.js' ||
66 file === 'thunking_manual.cc' ||
67 file === 'thunking_manual.js' ||
68 file === 'index.js' ||
69 file[0] === '.')) {
70 return;
71 }
72 const absoluteFilepath = path.join(currentDirectory, file);
73 const parsedFilepath = path.parse(file);
74 const parsedPath = path.parse(currentDirectory);
75
76 if (fs.statSync(absoluteFilepath).isDirectory()) {
77 if (fs.existsSync(absoluteFilepath + '/index.js')) {
78 if (checkFilterCondition(parsedFilepath.name, parsedPath.base)) {
79 testModules.push(pre + file);
80 }
81 } else {
82 loadTestModules(absoluteFilepath, pre + file + '/');
83 }
84 } else {
85 if (parsedFilepath.ext === '.js' && checkFilterCondition(parsedFilepath.name, parsedPath.base)) {
86 testModules.push(pre + parsedFilepath.name);
87 }
88 }
89 });
90}
91
92loadTestModules();
93

Callers 1

index.jsFile · 0.85

Calls 1

checkFilterConditionFunction · 0.85

Tested by

no test coverage detected