Skip to content
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

⚡️ Delay computation of Error stack when no cause #5584

Merged
merged 5 commits into from
Jan 9, 2025
Merged

⚡️ Delay computation of Error stack when no cause #5584

merged 5 commits into from
Jan 9, 2025

Conversation

dubzzz
Copy link
Owner

@dubzzz dubzzz commented Jan 8, 2025

Description

Up-to-now fast-check was always sealing the stack attached to errors as they popped. With error with cause capabilities we started to draft the required links to pass the instance of Error up to the end. We can thus safely delay the computation of the stack.

As delaying might have unwanted side-effects (maybe our instance of Error would be touched), we prefer not to make this change as part of a minor release.

Over all the breaking is justified by the change we do on the API of the failures. We dropped the previously precomputed errors and only keep the raw instance of errors. Users now have to manipulate it to extract the relevant error if needed.

First piece for #4416

ChecklistDon't delete this checklist and make sure you do the following before opening the PR

  • The name of my PR follows gitmoji specification
  • My PR references one of several related issues (if any)
    • New features or breaking changes must come with an associated Issue or Discussion
    • My PR does not add any new dependency without an associated Issue or Discussion
  • My PR includes bumps details, please run yarn bump and flag the impacts properly
  • My PR adds relevant tests and they would have failed without my PR (when applicable)

Advanced

💥 Breaking change: Change property failure output

  • Category: ⚡️ Improve performance
  • Impacts: Delay retrieval of the stack and message, change property failure output

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
**💥 Breaking change**

Up-to-now fast-check was always sealing the stack attached to errors as they popped. With error with cause capabilities we started to draft the required links to pass the instance of Error up to the end. We can thus safely delay the computation of the stack.

As delaying might have unwanted side-effects (maybe our instance of Error would be touched), we prefer not to make this change as part of a minor release.

Over all the breaking is justified by the change we do on the API of the failures. We dropped the previously precomputed errors and only keep the raw instance of errors. Users now have to manipulate it to extract the relevant error if needed.

First piece for #4416
Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: 7f4631f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
fast-check Major
@fast-check/ava Patch
@fast-check/jest Patch
@fast-check/vitest Patch
@fast-check/worker Patch

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

@dubzzz dubzzz changed the title ⚡️ Delay computation of Error stack when no cause (#4472) ⚡️ Delay computation of Error stack when no cause Jan 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

pkg-pr-new bot commented Jan 8, 2025

Open in Stackblitz@fast-check/examples

@fast-check/ava

npm i https://pkg.pr.new/@fast-check/ava@5584

@fast-check/expect-type

npm i https://pkg.pr.new/@fast-check/expect-type@5584

fast-check

npm i https://pkg.pr.new/fast-check@5584

@fast-check/jest

npm i https://pkg.pr.new/@fast-check/jest@5584

@fast-check/packaged

npm i https://pkg.pr.new/@fast-check/packaged@5584

@fast-check/poisoning

npm i https://pkg.pr.new/@fast-check/poisoning@5584

@fast-check/vitest

npm i https://pkg.pr.new/@fast-check/vitest@5584

@fast-check/worker

npm i https://pkg.pr.new/@fast-check/worker@5584

commit: 7f4631f

Copy link
Contributor

github-actions bot commented Jan 8, 2025

👋 A preview of the new documentation is available at: http://677ec8602d825e8419b810e3--dubzzz-fast-check.netlify.app

dubzzz added 3 commits January 9, 2025 08:15

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…o pr-4472
Copy link
Contributor

github-actions bot commented Jan 9, 2025

👋 A preview of the new documentation is available at: http://677f8880b7517df9440e30af--dubzzz-fast-check.netlify.app

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 42.85714% with 20 lines in your changes missing coverage. Please review.

Project coverage is 94.70%. Comparing base (bb46b92) to head (7f4631f).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...heck/src/check/runner/utils/RunDetailsFormatter.ts 30.76% 18 Missing ⚠️
packages/fast-check/src/utils/globals.ts 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5584      +/-   ##
==========================================
- Coverage   94.91%   94.70%   -0.21%     
==========================================
  Files         235      235              
  Lines       10043    10036       -7     
  Branches     2836     2823      -13     
==========================================
- Hits         9532     9505      -27     
- Misses        511      531      +20     
Flag Coverage Δ
unit-tests 94.70% <42.85%> (-0.21%) ⬇️
unit-tests-18.x-Linux 94.70% <42.85%> (-0.21%) ⬇️
unit-tests-20.x-Linux 94.70% <42.85%> (-0.21%) ⬇️
unit-tests-22.x-Linux 94.70% <42.85%> (-0.21%) ⬇️
unit-tests-latest-Linux 94.70% <42.85%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dubzzz dubzzz merged commit d8e7237 into main Jan 9, 2025
71 of 73 checks passed
@dubzzz dubzzz deleted the pr-4472 branch January 9, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant