fix(test): correct css-module E2E fixture setup and esbuild config#218
Merged
mohamedmansour merged 1 commit intomainfrom Apr 11, 2026
Merged
fix(test): correct css-module E2E fixture setup and esbuild config#218mohamedmansour merged 1 commit intomainfrom
mohamedmansour merged 1 commit intomainfrom
Conversation
KurtCattiSchmidt
previously approved these changes
Apr 11, 2026
The css-module Playwright tests were failing because of three test
infrastructure issues:
1. Missing SSR content in fixture HTML: Both fixture.html and
fixture-shadow.html had empty <test-module-host> elements. The shadow
DOM fixture was also missing the declarative shadow root with
shadowrootadoptedstylesheets. Without SSR content the framework
treated the elements as client-created instead of hydrating them.
2. esbuild stripping import attributes: The fixture build used
target es2022 without opting into import-attributes support. esbuild
silently removed { with: { type: 'css' } } from dynamic import()
calls in the compiled bundle, causing the browser to reject CSS
module imports as JavaScript (MIME type mismatch).
3. Missing async wait in test assertions: injectModuleStyle uses
import().then() to adopt stylesheets on dynamically-created
components. The test checked computed styles synchronously before
the promise resolved. Switched to Playwright toPass() polling.
Also remove the injectModuleStyle Node.js unit tests — they mocked
DOM queries for an implementation that uses browser-only CSS module
imports. The Playwright E2E tests provide real browser coverage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5571119 to
8333666
Compare
toddreifsteck
approved these changes
Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The css-module Playwright tests were failing because of three test infrastructure issues:
Missing SSR content in fixture HTML: Both fixture.html and fixture-shadow.html had empty elements. The shadow DOM fixture was also missing the declarative shadow root. Without SSR content the framework treated the elements as client-created instead of hydrating them.
esbuild stripping import attributes: The fixture build used target es2022 without opting into import-attributes support. esbuild silently removed { with: { type: 'css' } } from dynamic import() calls in the compiled bundle, causing the browser to reject CSS module imports as JavaScript (MIME type mismatch).
Missing async wait in test assertions: injectModuleStyle uses import().then() to adopt stylesheets on dynamically-created components. The test checked computed styles synchronously before the promise resolved. Switched to Playwright's toPass() polling to wait for async style injection.