Skip to content

fix(test): import EventEmitter from 'events', not 'stream'#40872

Merged
dgozman merged 1 commit into
microsoft:mainfrom
ofcRS:fix-watchmode-eventemitter-import
May 18, 2026
Merged

fix(test): import EventEmitter from 'events', not 'stream'#40872
dgozman merged 1 commit into
microsoft:mainfrom
ofcRS:fix-watchmode-eventemitter-import

Conversation

@ofcRS
Copy link
Copy Markdown
Contributor

@ofcRS ofcRS commented May 16, 2026

Summary

EventEmitter is the documented named export of node:events. It is not part of the documented public surface of node:stream — Node's CJS interop happens to expose it transitively (because stream's prototype chain reaches EventEmitter), but strict ESM analyzers reject the import statically as 'export not found'.

Switching packages/playwright/src/runner/watchMode.ts to import from 'events' keeps behavior identical on Node and lets strict-analysis runtimes load the test runner without choking on this import.

`EventEmitter` is the documented named export of `node:events`. It is
not part of the documented public surface of `node:stream` — Node's CJS
interop happens to expose it transitively, but strict ESM analyzers
(e.g. Bun) reject the import as 'export not found'.

Switching the import keeps behavior identical on Node and unblocks
runtimes that perform strict ESM static analysis.
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/http.spec.ts:103 › http transport browser lifecycle (isolated) @mcp-ubuntu-latest-chromium
❌ [webkit] › mcp/annotate.spec.ts:297 › should annotate via direct browser_annotate MCP call @mcp-windows-latest-webkit

7097 passed, 1104 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/popup.spec.ts:261 › should not throw when click closes popup `@ubuntu-22.04-chromium-tip-of-tree`
⚠️ [chromium-library] › library/video.spec.ts:682 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-arm-node20`
⚠️ [webkit-page] › page/page-set-input-files.spec.ts:38 › should upload a folder `@webkit-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:185 › should show snapshots for steps `@windows-latest-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:700 › should indicate current test status `@windows-latest-node20`

41909 passed, 850 skipped


Merge workflow run.

Copy link
Copy Markdown
Collaborator

@dgozman dgozman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix.

@dgozman dgozman merged commit 780f941 into microsoft:main May 18, 2026
43 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants