test: add npm pack timeout and stdio, improve test assertion for packed .test.ts files
This commit is contained in:
@@ -13,6 +13,8 @@ function getPackedPaths() {
|
|||||||
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
|
||||||
cwd: packageRoot,
|
cwd: packageRoot,
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
|
timeout: 30_000,
|
||||||
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
});
|
});
|
||||||
const [packResult] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>;
|
const [packResult] = JSON.parse(output) as Array<{ files: Array<{ path: string }> }>;
|
||||||
return packResult.files.map((file) => file.path);
|
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"));
|
assert.ok(packedPaths.includes("src/runtime.ts"));
|
||||||
|
|
||||||
// Ensure no test source files are included in npm pack
|
// 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")), []);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user