-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Provide global parameters definition #402
Comments
There is definitely a need for such feature. When I first though about this kind of feature I opened #65. Your suggestion is a bit different as it suggests to put the configuration in the code itself (instead of env in the other issue) but in a way they both fulfill the same need. The only blocking point I see with such is that it makes the behaviour of
fc.setParameters({ verbose: 1 })
fc.assert(fc.property(fc.boolean(), b => true), { seed: 42 })
// do we consider { seed: 42 } or { seed: 42, verbose: 1 }?
// IMO the second one seems better
Before implementing such I'll need to check how other big libraries or test frameworks deal with such global configurations that can be set both at test level and global level. |
@BourgoisMickael I just worked a bit on this feature request, see #439 After that commit a code like: test('test #1', () => {
fc.assert(
myProp1,
{ numRuns: 10 }
)
})
test('test #2', () => {
fc.assert(
myProp2,
{ numRuns: 10 } // duplicated
)
})
test('test #3', () => {
fc.assert(
myProp3,
{ numRuns: 10 } // duplicated
)
}) Can be written: fc.configureGlobal({ numRuns: 10 })
test('test #1', () => {
fc.assert(myProp1)
})
test('test #2', () => {
fc.assert(myProp2)
})
test('test #3', () => {
fc.assert(myProp3)
}) In the case of Jest test runner, the call to With this PR I add three main functions (the first one is certainly the most important one):
What do you think of this feature? Naming, usage...? |
🚀 Feature Request
Provide a way to define parameters on
fc
rather than defining them in eachfc.check
orfc.assert
.Motivation
I'm using the same parameter
{ verbose: true }
for each call offc.check
and I'd like to provide it only once for all my testsExample
Right now to achieve this behavior, I'm doing something like this:
The text was updated successfully, but these errors were encountered: