2023-08-31 17:50:03 +02:00
|
|
|
import { assertAllModulesInDirectory } from "./lib.ts";
|
2023-08-31 17:42:51 +02:00
|
|
|
|
2024-03-30 13:33:53 +01:00
|
|
|
/** A list of directories to check for all Nix modules being imported */
|
2023-08-31 17:51:44 +02:00
|
|
|
const dirs = [
|
|
|
|
"containers",
|
|
|
|
"home",
|
|
|
|
"modules",
|
|
|
|
"overlays",
|
|
|
|
"packages",
|
|
|
|
"specializations",
|
|
|
|
];
|
2023-08-31 17:48:25 +02:00
|
|
|
|
2024-03-30 13:27:53 +01:00
|
|
|
/** A helper function to return excluded files.
|
|
|
|
*
|
|
|
|
* @param directory The directory to get excludes for.
|
|
|
|
* @returns An array of excluded files for the given directory or undefined.
|
|
|
|
*/
|
|
|
|
function getExcludes(directory: string): string[] | undefined {
|
|
|
|
switch (directory) {
|
|
|
|
case "packages":
|
|
|
|
return ["hycov.nix"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-31 17:48:25 +02:00
|
|
|
for (const dir of dirs) {
|
|
|
|
Deno.test(`imports all modules in ./${dir}`, async () => {
|
2024-03-30 13:27:53 +01:00
|
|
|
await assertAllModulesInDirectory(dir, getExcludes(dir));
|
2023-08-31 17:51:44 +02:00
|
|
|
});
|
2023-08-31 17:48:25 +02:00
|
|
|
}
|