pack: exclude test sources from npm package and assert packaging in tests
- add src/.npmignore to exclude src/*.test.ts and nested test files when packaging - update src/package-manifest.test.ts to assert no .test.ts files are included in npm pack
This commit is contained in:
3
src/.npmignore
Normal file
3
src/.npmignore
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Exclude test sources from package when src/ is included via "files"
|
||||||
|
*.test.ts
|
||||||
|
**/*.test.ts
|
||||||
@@ -58,4 +58,7 @@ test("npm pack includes runtime package assets", () => {
|
|||||||
assert.ok(packedPaths.includes("package.json"));
|
assert.ok(packedPaths.includes("package.json"));
|
||||||
assert.ok(packedPaths.includes("index.ts"));
|
assert.ok(packedPaths.includes("index.ts"));
|
||||||
assert.ok(packedPaths.includes("src/runtime.ts"));
|
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")));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user