fix(test): avoid dev matchers clobbering stable runner in reporter tests#40187
fix(test): avoid dev matchers clobbering stable runner in reporter tests#40187yury-s wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Stop importing startHtmlReportServer from packages/playwright/lib/runner in reporter-html and reporter-blob tests. Instead, export a lightweight copy from playwright-test-fixtures that only depends on playwright-core HttpServer.
Test results for "MCP"7 failed 1 flaky6513 passed, 382 skipped Merge workflow run. |
Test results for "tests 1"1 failed 10 flaky39173 passed, 846 skipped Merge workflow run. |
Summary
1.60.0-alpha-2026-04-13, alltoMatchAriaSnapshotcalls inreporter-html.spec.tsandreporter-blob.spec.tsfail withtoMatchAriaSnapshot() must be called during the test.Root cause: Both test files imported
startHtmlReportServerfrom../../packages/playwright/lib/runner. This transitively loaded the dev code'smatchers/expect.jsbundle (viarunner → common → matchers/expect). Because jest-expect stores matchers onglobalThis[Symbol.for("$$jest-matchers-object")], the dev matchers overwrote the stable test runner's matchers. WhentoMatchAriaSnapshotwas later called, it executed the dev copy which references the dev code'sexpectConfig()— a module-level singleton wheretestInfowas never set (only the stable runner's worker sets it on its own copy). This was exposed by a120dec which changedtoMatchAriaSnapshotfrom usingglobals.currentTestInfo()(a shared global) toexpectConfig().testInfo(module-specific singleton).Fix: Replace the runner import with a lightweight
startHtmlReportServerhelper inplaywright-test-fixtures.tsthat only depends onplaywright-core'sHttpServer— no matchers loaded.Closes #40187