General source code refactoring
This commit is contained in:
13
scripts/test.cjs
Normal file
13
scripts/test.cjs
Normal file
@@ -0,0 +1,13 @@
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const { spawnSync } = require("node:child_process");
|
||||
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const files = fs.readdirSync(path.join(root, "tests")).filter(name => name.endsWith(".test.cjs")).sort();
|
||||
let failed = false;
|
||||
for (const file of files) {
|
||||
const result = spawnSync(process.execPath, [path.join(root, "tests", file)], { cwd: root, stdio: "inherit" });
|
||||
if (result.error) console.error(result.error.message);
|
||||
if (result.status !== 0) failed = true;
|
||||
}
|
||||
process.exitCode = failed ? 1 : 0;
|
||||
Reference in New Issue
Block a user