From 61ed491666408ca01d719a190566a0fc1f358996 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:00:53 +0800 Subject: [PATCH] feat(ci): json files should not be in root --- tests/json.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/json.test.js b/tests/json.test.js index 1a737900ec..c89b28b2fe 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -93,3 +93,14 @@ t("All files should have valid optional fields", (t) => { } }); }); + +const ignoredJSONFiles = [ + "package-lock.json", + "package.json" +] + +t("JSON files should not be in the root directory", (t) => { + const files = fs.readdirSync(path.resolve()).filter((file) => file.endsWith(".json") && !ignoredJSONFiles.includes(file));; + + t.is(files.length, 0, "JSON files should not be in the root directory"); +});