Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created March 28, 2020 15:51
Show Gist options
  • Save jsmanifest/b0920ee4411a7c919eb7cedd88e4bd5c to your computer and use it in GitHub Desktop.
Save jsmanifest/b0920ee4411a7c919eb7cedd88e4bd5c to your computer and use it in GitHub Desktop.
function findEmptyTests(basepath) {
let emptyTests = {}
if (isDirectory(basepath)) {
const dir = fs.readdirSync(basepath)
for (let index = 0; index < dir.length; index++) {
const filename = dir[index]
const filepath = `${basepath}/${filename}`
if (isDirectory(filepath)) {
if (filename === '__test__') {
const testDir = fs.readdirSync(filepath)
if (!hasTest(testDir)) {
emptyTests[filepath] = createMissingTestsObject(basepath, testDir)
}
} else {
emptyTests = { ...emptyTests, ...findEmptyTests(filepath) }
}
}
}
}
return emptyTests
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment