MCPcopy Index your code
hub / github.com/SchemaStore/schemastore / onTestDir

Function onTestDir

cli.js:1224–1254  ·  view source on GitHub ↗
(/** @type {string} */ rootTestDir)

Source from the content-addressed store, hash-verified

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 /**

Callers 1

assertFileSystemIsValidFunction · 0.85

Calls 3

isIgnoredFileFunction · 0.85
printErrorAndExitFunction · 0.85
existsFunction · 0.70

Tested by

no test coverage detected