-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expect: Export expect as default export #11490
Conversation
Hi @NaridaL! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
89fffa8
to
0523c5a
Compare
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
This allows types to be exported as well. Fixes jestjs#11487 Strictly speaking a breaking change, as expect = require('expect') not longer works, but as this is usually used as a global, this shouldn't be much of an issue.
0523c5a
to
70bb15f
Compare
Codecov Report
@@ Coverage Diff @@
## master #11490 +/- ##
==========================================
- Coverage 68.95% 68.95% -0.01%
==========================================
Files 312 312
Lines 16310 16309 -1
Branches 4722 4722
==========================================
- Hits 11247 11246 -1
Misses 5035 5035
Partials 28 28
Continue to review full report at Codecov.
|
As you note, this is a breaking change so we cannot land it until Jest 28. |
@SimenB OK, apart from that, is this good to be merged as-is? |
Good point, thanks! 👍 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This allows types to be exported as well.
Fixes #11487
Strictly speaking a breaking change, as expect = require('expect') not longer works, but as this is usually used as a global, this shouldn't be much of an issue.
Summary
To recap #11487 , the "expect" doesn't export the actual
Matchers
interface which theexpect()
function returns, but rather an interface which extends Matchers. This means that you can't extend the returned interface with typescript's declaration merging.This the cleaner solution, which replaces the
export =
withexport default
which allows re-exporting types.Test plan
Is it possible to test the types?
packages/expect/src/__tests__/extend.test.ts
has TS errors, but still shows up green.