test: add npm pack timeout and stdio, improve test assertion for packed .test.ts files

This commit is contained in:
pi
2026-04-11 01:59:43 +01:00
parent e0f5977446
commit 6b67e090a0

View File

@@ -13,6 +13,8 @@ function getPackedPaths() {
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
cwd: packageRoot,
encoding: "utf8",
timeout: 30_000,
stdio: ["ignore", "pipe", "pipe"],
});
const [packResult] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>;
return packResult.files.map((file) => file.path);
@@ -60,5 +62,5 @@ test("npm pack includes runtime package assets", () => {
assert.ok(packedPaths.includes("src/runtime.ts"));
// Ensure no test source files are included in npm pack
assert.ok(!packedPaths.some((p) => p.endsWith(".test.ts")));
assert.deepEqual(packedPaths.filter((p) => p.endsWith(".test.ts")), []);
});