-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[Discussion] Expect only overrides error stack for built-in matchers #5162
Changes from 1 commit
f39d750
e7d9bbd
9c10921
eb5d29c
ea088cf
f2e7335
3e00753
9e0cfae
31f8e58
c388a49
0c5c78c
5843ab5
f902b4b
bd21922
3ef09ea
f88bf07
ff50df6
2da0eee
6f6dd91
e8ab539
7dad466
179093c
b8c6bfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,13 @@ export const setState = (state: Object) => { | |
|
||
export const getMatchers = () => global[JEST_MATCHERS_OBJECT].matchers; | ||
|
||
export const setMatchers = (matchers: MatchersObject) => { | ||
export const setMatchers = (matchers: MatchersObject, isInternal: boolean) => { | ||
for (const key in matchers) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the spirit of babel/babel#6748 can we change it to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. Sure thing! |
||
const matcher = matchers[key]; | ||
Object.defineProperty(matcher, '__jestInternal', { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we not use a Symbol instead to make this actually secret? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
value: isInternal, | ||
}); | ||
} | ||
|
||
Object.assign(global[JEST_MATCHERS_OBJECT].matchers, matchers); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! Removed. 😄