From e0f59774466c5b5c58e0899e506eb1befe9f1ba3 Mon Sep 17 00:00:00 2001 From: pi Date: Sat, 11 Apr 2026 01:02:45 +0100 Subject: [PATCH] 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 --- src/.npmignore | 3 +++ src/package-manifest.test.ts | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 src/.npmignore diff --git a/src/.npmignore b/src/.npmignore new file mode 100644 index 0000000..ed3b6c7 --- /dev/null +++ b/src/.npmignore @@ -0,0 +1,3 @@ +# Exclude test sources from package when src/ is included via "files" +*.test.ts +**/*.test.ts diff --git a/src/package-manifest.test.ts b/src/package-manifest.test.ts index 9757e8c..98078c7 100644 --- a/src/package-manifest.test.ts +++ b/src/package-manifest.test.ts @@ -58,4 +58,7 @@ test("npm pack includes runtime package assets", () => { assert.ok(packedPaths.includes("package.json")); assert.ok(packedPaths.includes("index.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"))); });