Update json.test.js

This commit is contained in:
Jon authored and GitHub committed 2024-11-17 16:05:49 -05:00
1 parent f3b6d4d1e7
commit 0c5b45f901
1 file changed
+6
+6
View File
@@ -42,6 +42,12 @@ function validateOptionalFields(t, obj, optionalFields, file) {
}
t("All files should be valid JSON", (t) => {
const reservedFiles = fs.existsSync(reservedDomainsPath)
? fs.readdirSync(reservedDomainsPath).filter(file => {
const filePath = path.join(reservedDomainsPath, file);
return fs.lstatSync(filePath).isFile(); // Only include files
})
: [];
files.forEach((file) => {
t.notThrows(() => fs.readJsonSync(path.join(domainsPath, file)), `${file}: Invalid JSON file`);
});