-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Drop itProp
for it.prop
in @fast-check/jest
#3303
Comments
@TomerAberbach I'm pretty sure you'll have a useful opinion on this one. |
I like the idea of being consistent with Jest! I do have a couple nitpicks with the currently proposed API though. First, since Jest's
The "an array of" part doesn't make sense for
Based on that, your first example would be written as: it.prop([fc.string(), fc.string(), fc.string()])('should always contain its substring', (a, b, c) => {
expect(a + b + c).toContain(b);
}, {/* assert options */}); And your second example would be written as: it.prop(fc.record({ a: fc.string(), b: fc.string(), c: fc.string() }))('should always contain its substring', ({ a, b, c }) => {
expect(a + b + c).toContain(b);
}, {/* assert options */}); I think this would be most consistent with Jest's API. Not sure there's a compelling reason to special case the object literal case if Jest doesn't (it's just case number 2 in my list above). Second, Jest supports a timeout for the third parameter of the function returned by |
Thanks a lot for the suggestions. I started to POC a very first version of it. So far I only implemented the tuple-based version but I'll add an object one soon. For the later, I believe the best would be not to ask for the |
The fast-check integration with Jest has a new syntax based on Jest's standard API. This change helps to reduce the indentation in a few places. Refs dubzzz/fast-check#3303
💡 Idea
The source API of Jest is only based on
it
. You can callit.each
,it.failing.each
,it.concurrent.failing.each
and many others.In order to be even more integrated with the existing API provided by Jest an idea could be to add
prop
as any other customizer already provided by Jest. More precisely to haveprop
every time Jest offereach
.Then we need to find a new way to instantiate fast-check that will be closer to the
it.each
one.it.each
is basically ait.each(inputs)(name, fn, timeout)
what if we proposed something like:And possibly a variant:
The text was updated successfully, but these errors were encountered: