Skip to content

Commit 449b4d4

Browse files
committed
chore(gates): keep macOS helper test sources out of npm packs
The publish asset guard already rejects shipped benchmark scripts; add the sibling invariant for the helper's Tests/ directory so a future files-list edit cannot re-ship sources the install never compiles.
1 parent ce119a5 commit 449b4d4

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎scripts/__tests__/size-report-package.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@ test('publish package requires both Android helpers and excludes benchmark scrip
4141
]),
4242
/benchmark or build scripts/,
4343
);
44+
assert.throws(
45+
() =>
46+
assertPublishPackageContents([
47+
...fixturePack.files,
48+
{
49+
path: 'apple/macos-helper/Tests/AgentDeviceMacOSInputTests/ScheduleTests.swift',
50+
size: 1,
51+
},
52+
]),
53+
/macOS helper test sources/,
54+
);
4455
});
4556

4657
test('Markdown emphasizes total install size and startup without duplicate breakdowns', () => {

‎scripts/size-report-package.mjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ export function assertPublishPackageContents(entries, options = {}) {
7676
if (forbiddenPaths.length > 0) {
7777
throw new Error(`npm pack includes benchmark or build scripts: ${forbiddenPaths.join(', ')}`);
7878
}
79+
// The macOS helper ships as buildable source and the helper's own manifest declares no test
80+
// targets, so anything under its Tests/ directory could only ever be dead weight the install
81+
// never compiles. Its tests live in apple/macos-helper-tests, which `files` does not list.
82+
const shippedSwiftTests = paths.filter(
83+
(entryPath) =>
84+
entryPath === 'apple/macos-helper/Tests' || entryPath.startsWith('apple/macos-helper/Tests/'),
85+
);
86+
if (shippedSwiftTests.length > 0) {
87+
throw new Error(`npm pack includes macOS helper test sources: ${shippedSwiftTests.join(', ')}`);
88+
}
7989
}
8090

8191
function parseNpmPackOutput(stdout) {

0 commit comments

Comments
 (0)