-
-
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
Jest All Asymmetric Matchers at Point #8776
Comments
declare namespace jest {
interface Matchers<R> {
all(fn: (received: R) => void): R;
}
interface Expect {
all(fn: (received: any) => any): any;
}
} |
Not sure I follow - something like https://github.com/jest-community/jest-extended/blob/master/README.md#tosatisfypredicate?
That's not really possible as |
The code block in the opened issue above is an executable jest test file with these types. This is not a matcher, I have only implemented it using the expect.extend api. It is different from (jest community / tosatisfypredicate) I have extracted a piece of the code block from above to better illustrate the point: it("jest all asymmetric matcher", async () => {
expect(1).toEqual(
expect.all(v => { // -----------------> THIS IS WHAT THIS DOES
expect(v).toBe(1);
expect(v + 1).toBe(2);
})
);
}); It is possible to preserve nested error messages. The implementation above does this. Although, I am not sure if it is breaking any other useful semantics, seems to work for me. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
Nest jest asymmetric matchers / use multiple of them at same point.
Preserve all error messages in each of nested matcher to quickly resolve errors.
Something like this?
Pitch
Why does this feature belong in the Jest core platform?
todo / to test
references #5788
The text was updated successfully, but these errors were encountered: