chore(test-runner): vendor the expect library - #40301
Conversation
Inlines the parts of expect@30.2.0 that Playwright actually uses into packages/playwright/src/matchers/expectLibrary.ts. Drops spy matchers, jest snapshot matchers, expect.assertions/hasAssertions, and the public addEqualityTesters API (matcher context keeps customTesters: [] so built-in matcher bodies stay unchanged). Removes the expect, @jest/get-type, and jest-util dependencies; inlines getType, isPrimitive, isPromise locally.
Removes global state plumbing (getState/setState/JEST_MATCHERS_OBJECT), dontThrow(), and unused MatcherState fields (currentTestName, testPath, expand — expand was always false, so isExpand(this.expand) is now just false). Unexports types and helpers that no caller imports.
Removes wrapUnknownMatcherProxy and the matching "helpful expect errors" tests. Accessing a nonexistent matcher now yields the native "is not a function" TypeError instead of a custom message.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Pavel Feldman (pavelfeldman)
left a comment
There was a problem hiding this comment.
Let's cleanup package.json - sounds like expect is being pulled via packages/playwright/package.json's dev deps - that is not orderly...
458bbd1 to
5c24dfb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5c24dfb to
8986e17
Compare
Test results for "MCP"3 failed 2 flaky6429 passed, 976 skipped Merge workflow run. |
Test results for "tests 1"6 flaky41176 passed, 847 skipped Merge workflow run. |
Test results for "tests 2"2 failed 75 flaky273272 passed, 12555 skipped Merge workflow run. |
Test results for "tests others"2 fatal errors, not part of any test 18674 passed, 617 skipped, 838 did not run Merge workflow run. |
396a39b
into
microsoft:main
Summary
expectlibrary (v30.2.0) intopackages/playwright/src/matchers/expectLibrary.ts, adapted and trimmed to Playwright's needs.expect.tsrewritten on top of the vendored library, no more proxies, global variables, smaller interface into the test runner, etc.