19 lines
683 B
JavaScript
19 lines
683 B
JavaScript
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
const { spawnSync } = require("node:child_process");
|
|
|
|
// Windows 셸의 glob 확장 여부와 무관하게 실제 테스트 파일을 Node runner에 전달한다.
|
|
const root = path.resolve(__dirname, "..");
|
|
const files = fs
|
|
.readdirSync(path.join(root, "tests"))
|
|
.filter((name) => name.endsWith(".test.cjs"))
|
|
.sort()
|
|
.map((name) => path.join(root, "tests", name));
|
|
if (!files.length) throw new Error("No refactor tests found");
|
|
const result = spawnSync(process.execPath, ["--test", ...files], {
|
|
cwd: root,
|
|
stdio: "inherit",
|
|
});
|
|
if (result.error) throw result.error;
|
|
process.exitCode = result.status ?? 1;
|