From 2a1d126ee98d1fbaa2bf26cad01624db99358767 Mon Sep 17 00:00:00 2001 From: Jon <66625200+Kyro3400@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:18:28 -0500 Subject: [PATCH] Update json.test.js --- tests/json.test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/json.test.js b/tests/json.test.js index 1617282c..ff4284a3 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -45,9 +45,16 @@ 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 + try { + // Ensure the file is not a directory or symbolic link + return fs.statSync(filePath).isFile(); + } catch (err) { + console.error(`Error reading reserved file: ${filePath}`, err); + return false; // Skip any errors + } }) : []; + files.forEach((file) => { t.notThrows(() => fs.readJsonSync(path.join(domainsPath, file)), `${file}: Invalid JSON file`); });