diff --git a/packages/cli/src/commands/play.test.ts b/packages/cli/src/commands/play.test.ts index fda0351e6d..f4fec2413c 100644 --- a/packages/cli/src/commands/play.test.ts +++ b/packages/cli/src/commands/play.test.ts @@ -251,6 +251,31 @@ describe("registerCompositionRoute", () => { expect(mocks.resolveProxy).not.toHaveBeenCalled(); }); + it("serves the runtime script ahead of every author script", async () => { + // Compositions read `window.__hyperframes.getVariables()` from an inline + // script at init. A runtime injected before
', + "", + "loads after that script, + // so the documented API is undefined exactly where authors are told to call + // it. Pin the ordering at the served-document boundary. + const project = tmpProject(); + writeFileSync( + join(project.dir, "index.html"), + [ + '
', + '