* creates a configuration list for all available test modules * The configuration object contains the expected init function names and corresponding export property names
(currentDirectory = path.join(__dirname, '/../test'), pre = '')
| 37 | * The configuration object contains the expected init function names and corresponding export property names |
| 38 | */ |
| 39 | function listOfTestModules (currentDirectory = path.join(__dirname, '/../test'), pre = '') { |
| 40 | fs.readdirSync(currentDirectory).forEach((file) => { |
| 41 | if (file === 'binding.cc' || |
| 42 | file === 'binding.gyp' || |
| 43 | file === 'build' || |
| 44 | file === 'common' || |
| 45 | file === 'thunking_manual.cc' || |
| 46 | file === 'addon_build' || |
| 47 | file[0] === '.') { |
| 48 | return; |
| 49 | } |
| 50 | const absoluteFilepath = path.join(currentDirectory, file); |
| 51 | const fileName = file.toLowerCase().replace('.cc', ''); |
| 52 | if (fs.statSync(absoluteFilepath).isDirectory()) { |
| 53 | buidDirs[fileName] = []; |
| 54 | listOfTestModules(absoluteFilepath, pre + file + '/'); |
| 55 | } else { |
| 56 | if (!file.toLowerCase().endsWith('.cc')) return; |
| 57 | if (currentDirectory.trim().split('/test/').length > 1) { |
| 58 | buidDirs[currentDirectory.split('/test/')[1].toLowerCase()].push(fileName); |
| 59 | } |
| 60 | const relativePath = (currentDirectory.split(`${fileName}.cc`)[0]).split('/test/')[1] || ''; |
| 61 | buildFiles[fileName] = { dir: relativePath, propertyName: getExportPropertyName(fileName), objectName: getExportObjectName(fileName) }; |
| 62 | } |
| 63 | }); |
| 64 | } |
| 65 | listOfTestModules(); |
| 66 | |
| 67 | module.exports = { |
no test coverage detected