jest-community / eslint-plugin-jest

ESLint plugin for Jest
MIT License
1.13k stars 230 forks source link

[expect-expect and no-standalone-expect] `additionalTestBlockFunctions` does not recognize `test.each`-like functions #1475

Open TomerAberbach opened 10 months ago

TomerAberbach commented 10 months ago

See https://github.com/dubzzz/fast-check/issues/4474

fast-check exposes a test.prop function that's invoked similarly to Jest's built-in test.each. However, it doesn't seem like expect-expect and no-standalone-expect's additionalTestBlockFunctions option supports test.each-like function. Probably because the test lambda is passed to an anonymous function instead of test.prop itself (i.e. test.prop(args)(theTestLambda))

Would it be possible to support test.each-like functions?

G-Rath commented 10 months ago

~Could you give me a small example of test.prop being used? I've never used fast-check and can't find anything about test.prop or testProp so it's hard to triage this 😅~

nw found it: https://fast-check.dev/docs/ecosystem/#fast-checkjest-

TomerAberbach commented 10 months ago

Ah sorry, thanks for looking! That is indeed right 👍

G-Rath commented 10 months ago

I'm somewhat reserved these days on adding support for this kind of thing because we've got to draw the line in how far we go to support non-jest variations of stuff somewhere but that isn't an outright no.

One thing that comes to mind is globalAliases, but part of the challenge is you're not providing a direct replacement for jest which exposes us to that variation problem: we'd need to be expressing "this is like it.each, but it doesn't otherwise act like it"...

I'll sit on this for a bit and play around with our existing logic when I have a chance to see if it could fit naturally in.