(fromDir: string, nested = 2)
| 82 | // The max depth is 10 but the main project directory and the src directory itself count, |
| 83 | // so we start at 2. |
| 84 | const walkDir = async (fromDir: string, nested = 2): Promise<void> => { |
| 85 | await Promise.all(readdirSync(fromDir).map(async filename => { |
| 86 | const fullFilename = `${fromDir}/${filename}` |
| 87 | if (await fileExists(fullFilename)) { |
| 88 | const isLink = await isSymbolicLink(fullFilename) |
| 89 | const resolvedFilename = isLink ? await realPathForSymbolicLink(fullFilename) : fullFilename |
| 90 | if (await isDir(resolvedFilename)) { |
| 91 | if (isLink) { |
| 92 | fatalIssue(`sym links to directories are not allowed (${fullFilename})`) |
| 93 | } else { |
| 94 | // maximum depth is defined by server |
| 95 | if (nested < 10) { |
| 96 | await walkDir(fullFilename, nested + 1) |
| 97 | } else { |
| 98 | fatalIssue(`drivers directory nested too deeply (at ${fullFilename}); max depth is 10`) |
| 99 | } |
| 100 | } |
| 101 | } else { |
| 102 | const filenameForTestMatch = fullFilename.substring(srcDir.length + 1) |
| 103 | if (!testFileMatchers.some(matcher => matcher(filenameForTestMatch))) { |
| 104 | const archiveName = `src${fullFilename.substring(srcDir.length)}` |
| 105 | zip.file(archiveName, createReadStream(fullFilename)) |
| 106 | } |
| 107 | } |
| 108 | } else { |
| 109 | fatalIssue(`sym link ${fullFilename} points to non-existent file`) |
| 110 | } |
| 111 | })) |
| 112 | } |
| 113 | |
| 114 | await walkDir(srcDir) |
| 115 | return successful |
no test coverage detected