test(package): harden layout exclusion fixtures
This commit is contained in:
@@ -150,7 +150,18 @@ function writeFakeInternalArtifacts(packagePaths: readonly string[]): void {
|
|||||||
for (const packagePath of packagePaths) {
|
for (const packagePath of packagePaths) {
|
||||||
const artifactPath = join(repositoryRoot, packagePath)
|
const artifactPath = join(repositoryRoot, packagePath)
|
||||||
mkdirSync(dirname(artifactPath), { recursive: true })
|
mkdirSync(dirname(artifactPath), { recursive: true })
|
||||||
writeFileSync(artifactPath, "# Fake internal artifact for package-layout-exclusion.test.ts\n")
|
const content = packagePath.endsWith("/SKILL.md")
|
||||||
|
? [
|
||||||
|
"---",
|
||||||
|
`name: ${fakeArtifactName}`,
|
||||||
|
"description: Internal fake skill artifact for package layout exclusion tests.",
|
||||||
|
"---",
|
||||||
|
"",
|
||||||
|
"# Fake internal artifact for package-layout-exclusion.test.ts",
|
||||||
|
"",
|
||||||
|
].join("\n")
|
||||||
|
: "# Fake internal artifact for package-layout-exclusion.test.ts\n"
|
||||||
|
writeFileSync(artifactPath, content)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +194,9 @@ describe("published package layout exclusions", () => {
|
|||||||
test("#given internal-only skill assets #when packing package #then forbidden skill assets do not ship", async () => {
|
test("#given internal-only skill assets #when packing package #then forbidden skill assets do not ship", async () => {
|
||||||
// given
|
// given
|
||||||
expect(collectExistingFakeInternalSkillArtifactPaths()).toEqual(fakeInternalSkillArtifactPaths.toSorted())
|
expect(collectExistingFakeInternalSkillArtifactPaths()).toEqual(fakeInternalSkillArtifactPaths.toSorted())
|
||||||
|
for (const packagePath of fakeInternalSkillArtifactPaths) {
|
||||||
|
expect(readFileSync(join(repositoryRoot, packagePath), "utf8")).toStartWith("---\n")
|
||||||
|
}
|
||||||
|
|
||||||
// when
|
// when
|
||||||
const packedPaths = await packDryRunPaths()
|
const packedPaths = await packDryRunPaths()
|
||||||
@@ -190,7 +204,7 @@ describe("published package layout exclusions", () => {
|
|||||||
// then
|
// then
|
||||||
const packedInternalSkillPaths = fakeInternalSkillArtifactPaths.filter((packagePath) => packedPaths.has(packagePath))
|
const packedInternalSkillPaths = fakeInternalSkillArtifactPaths.filter((packagePath) => packedPaths.has(packagePath))
|
||||||
expect(packedInternalSkillPaths).toEqual([])
|
expect(packedInternalSkillPaths).toEqual([])
|
||||||
})
|
}, { timeout: 20_000 })
|
||||||
|
|
||||||
test("#given internal-only command assets #when packing package #then forbidden command assets do not ship", async () => {
|
test("#given internal-only command assets #when packing package #then forbidden command assets do not ship", async () => {
|
||||||
// given
|
// given
|
||||||
@@ -204,5 +218,5 @@ describe("published package layout exclusions", () => {
|
|||||||
// then
|
// then
|
||||||
const packedInternalCommandPaths = fakeInternalCommandArtifactPaths.filter((packagePath) => packedPaths.has(packagePath))
|
const packedInternalCommandPaths = fakeInternalCommandArtifactPaths.filter((packagePath) => packedPaths.has(packagePath))
|
||||||
expect(packedInternalCommandPaths).toEqual([])
|
expect(packedInternalCommandPaths).toEqual([])
|
||||||
})
|
}, { timeout: 20_000 })
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user