(/** @type {string} */ rootTestDir)
| 1222 | |
| 1223 | await Promise.all([onTestDir(TestPositiveDir), onTestDir(TestNegativeDir)]) |
| 1224 | async function onTestDir(/** @type {string} */ rootTestDir) { |
| 1225 | for (const dirent of await fs.readdir(rootTestDir, { |
| 1226 | withFileTypes: true, |
| 1227 | })) { |
| 1228 | if (isIgnoredFile(dirent.name)) continue |
| 1229 | |
| 1230 | const testDir = path.join(rootTestDir, dirent.name) |
| 1231 | if (!dirent.isDirectory()) { |
| 1232 | printErrorAndExit(new Error(), [ |
| 1233 | `Expected only directories under directory "${rootTestDir}"`, |
| 1234 | `Found non-directory at "./${testDir}"`, |
| 1235 | ]) |
| 1236 | } |
| 1237 | |
| 1238 | for (const dirent of await fs.readdir(testDir, { |
| 1239 | withFileTypes: true, |
| 1240 | })) { |
| 1241 | if (isIgnoredFile(dirent.name)) continue |
| 1242 | |
| 1243 | const schemaName = dirent.name |
| 1244 | const schemaPath = path.join(testDir, schemaName) |
| 1245 | |
| 1246 | if (!dirent.isFile()) { |
| 1247 | printErrorAndExit(new Error(), [ |
| 1248 | `Expected only files under directory "./${testDir}"`, |
| 1249 | `Found non-file at "./${schemaPath}"`, |
| 1250 | ]) |
| 1251 | } |
| 1252 | } |
| 1253 | } |
| 1254 | } |
| 1255 | } |
| 1256 | |
| 1257 | /** |
no test coverage detected