diff --git a/packages/producer/src/services/htmlCompiler.test.ts b/packages/producer/src/services/htmlCompiler.test.ts index d883aeee..8446c6d7 100644 --- a/packages/producer/src/services/htmlCompiler.test.ts +++ b/packages/producer/src/services/htmlCompiler.test.ts @@ -152,6 +152,26 @@ describe("inlineExternalScripts", () => { } }); + it("preserves non-src script attributes when inlining", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = mock( + async () => new Response('console.log("module");', { status: 200 }), + ) as any; + + try { + const html = + '
'; + const result = await inlineExternalScripts(html); + + expect(result).toMatch(/ { const originalFetch = globalThis.fetch; globalThis.fetch = mock( @@ -169,6 +189,45 @@ describe("inlineExternalScripts", () => { } }); + it("preserves literal replacement tokens in downloaded script content", async () => { + const originalFetch = globalThis.fetch; + globalThis.fetch = mock( + async () => + new Response('const before = "$`"; const after = "$\'"; const both = "$&";', { + status: 200, + }), + ) as any; + + try { + const html = `