fast-check icon indicating copy to clipboard operation
fast-check copied to clipboard

✨ Add ability to limit shrink path

Open dubzzz opened this issue 1 year ago • 3 comments

Description

We want to offer a way for our users to limit the depth and overall size of the shrinking capabilities. At the moment, they can only either apply shrink or drop it totally. We want to offer a finer way to control the shrinks.

This proposal is related to #4162.

At the moment, we added an extra method for all our arbitrary but I feel that it will not be scalable. I believe we should go for yet another utility arbitrary that will be responsible to offer such capabilities. Regarding offering these capabilities at assert level itself, we should probably (option 1) do as we used to do for timeouts..., or (option 2) start thinking into some kind of plugin system. Option 1 seems to be a valid option for version 3 of fast-check, we could also start offering a noShrink utility either hidden behind limitShrink one (probably better) or directly.

NOTE: Not ready yet, we should move from methods to a dedicated utility.

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

  • [x] The name of my PR follows gitmoji specification
  • [x] My PR references one of several related issues (if any)
    • [x] New features or breaking changes must come with an associated Issue or Discussion
    • [x] My PR does not add any new dependency without an associated Issue or Discussion
  • [x] 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

  • [x] Category: ✨ Introduce new features
  • [x] Impacts: New arbitrary

dubzzz avatar May 21 '24 07:05 dubzzz

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit dd752cbe9146b53182d681e9d4ea394718feedd9:

Sandbox Source
@fast-check/examples Configuration

codesandbox-ci[bot] avatar May 21 '24 07:05 codesandbox-ci[bot]

Codecov Report

Attention: Patch coverage is 98.65772% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.90%. Comparing base (8483134) to head (dd752cb). Report is 7 commits behind head on main.

Files Patch % Lines
packages/fast-check/src/arbitrary/limitShrink.ts 94.44% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5006      +/-   ##
==========================================
+ Coverage   96.89%   96.90%   +0.01%     
==========================================
  Files         215      218       +3     
  Lines       16384    16533     +149     
  Branches     2670     2703      +33     
==========================================
+ Hits        15875    16022     +147     
- Misses        509      511       +2     
Flag Coverage Δ
unit-tests 96.90% <98.65%> (+0.01%) :arrow_up:
unit-tests-18.x-Linux 96.90% <98.65%> (+0.01%) :arrow_up:
unit-tests-20.x-Linux 96.90% <98.65%> (+0.01%) :arrow_up:
unit-tests-22.x-Linux 96.90% <98.65%> (+0.01%) :arrow_up:
unit-tests-latest-Linux ?

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 21 '24 07:05 codecov[bot]

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

github-actions[bot] avatar Jun 27 '24 07:06 github-actions[bot]

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

github-actions[bot] avatar Jul 05 '24 13:07 github-actions[bot]