Skip to content

Clean up CSS HMR invalidation tests#16824

Open
thelazylamaGit wants to merge 13 commits into
withastro:flue/fix-16780from
thelazylamaGit:flue/fix-16780
Open

Clean up CSS HMR invalidation tests#16824
thelazylamaGit wants to merge 13 commits into
withastro:flue/fix-16780from
thelazylamaGit:flue/fix-16780

Conversation

@thelazylamaGit
Copy link
Copy Markdown

@thelazylamaGit thelazylamaGit commented May 21, 2026

This PR targets astro-bot’s branch for #16783 and applies the requested CI/test clean up + a small dev-server regression test for the actual stale inline CSS behaviour. It does not change the fix implementation.

Changes

  • Adds idToModuleMap: new Map() to the existing hmr-reload.test.ts mock so it matches the new module graph iteration added in Fix stale inline CSS in server-rendered HTML during dev #16783.
  • Replaces the unsafe Function cast in hmr-css-invalidation.test.ts with a local typed hot update handler helper.
  • Adds a minimal dev-server fixture test that requests a getStaticPaths() route, edits global CSS, then verifies the next SSR response contains updated inline CSS.
  • Keeps the main CSS HMR invalidation implementation unchanged.

Testing

  • Fixes the current Test (astro) failure caused by the mocked environment.moduleGraph missing idToModuleMap.
  • Fixes the lint/type failure from @typescript-eslint/no-unsafe-function-type.
  • Keeps unit coverage for virtual:astro:dev-css:* module graph invalidation.
  • Adds integration-style coverage for the actual stale SSR inline CSS behavior using Astro’s dev server, fixture.fetch(), and fixture.editFile().

Docs

No docs changes needed. This only fixes internal dev-server HMR cache invalidation behavior and test coverage.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: eb5b07d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label May 21, 2026
@thelazylamaGit thelazylamaGit changed the title Flue/fix 16780 Clean up CSS HMR invalidation tests May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant