-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
💥 Error with cause by default #5590
Conversation
**💥 Breaking change** Until now, fast-check have been merging the content and stack of the original Error that caused the property to fail into its own Error. With the recent (2022) introduction of cause on Errors, this complex logic can be dropped in favor of the native cause mechanism. This PR makes cause mode the default. Before this PR, toggling it was possible via `errorWithCause: true` on `fc.assert`. Given not all test runners properly support causes attached to the Error, we offer a fallback for users willing to preserve the old behaviour. It can be toggled via `includeErrorInReport: true` on `fc.assert`. Related to #4416.
🦋 Changeset detectedLatest commit: b3be369 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Open in Stackblitz • @fast-check/examples @fast-check/ava
@fast-check/expect-type
@fast-check/jest
fast-check
@fast-check/packaged
@fast-check/poisoning
@fast-check/vitest
@fast-check/worker
commit: |
👋 A preview of the new documentation is available at: http://6780dc3bc9adf6629bbba664--dubzzz-fast-check.netlify.app |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5590 +/- ##
==========================================
+ Coverage 94.70% 94.77% +0.06%
==========================================
Files 235 235
Lines 10036 10036
Branches 2821 2827 +6
==========================================
+ Hits 9505 9512 +7
+ Misses 531 524 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
👋 A preview of the new documentation is available at: http://6780e1379d9bf278d5b3b806--dubzzz-fast-check.netlify.app |
👋 A preview of the new documentation is available at: http://6781ad63c4a4228def287ea0--dubzzz-fast-check.netlify.app |
Description
Until now, fast-check have been merging the content and stack of the original Error that caused the property to fail into its own Error. With the recent (2022) introduction of cause on Errors, this complex logic can be dropped in favor of the native cause mechanism.
This PR makes cause mode the default. Before this PR, toggling it was possible via
errorWithCause: true
onfc.assert
.Given not all test runners properly support causes attached to the Error, we offer a fallback for users willing to preserve the old behaviour. It can be toggled via
includeErrorInReport: true
onfc.assert
.Related to #4416.
Checklist — Don't delete this checklist and make sure you do the following before opening the PR
yarn bump
and flag the impacts properlyAdvanced
💥 Breaking change: The display of errors being reported by fast-check will change. Many test runners do support that but some still don't support it so a flag will have to be pass for them to display the errors correctly.