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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot configure eslint-plugin-jest's expect-expect and no-standalone-expect rules to recognize test.prop #4474

Open
TomerAberbach opened this issue Nov 25, 2023 · 5 comments

Comments

@TomerAberbach
Copy link
Sponsor Contributor

馃悰 Bug Report

I used to configure eslint-plugin-jest's expect-expect rule like so:

{
  "jest/expect-expect": [
    "error",
    {
      "assertFunctionNames": ["expect"],
      "additionalTestBlockFunctions": ["testProp"]
    }
  ]
}

And it would work for fast-check's testProp function. However, now that test.prop is preferred and testProp is deprecated, I tried switching to:

{
  "jest/expect-expect": [
    "error",
    {
      "assertFunctionNames": ["expect"],
-      "additionalTestBlockFunctions": ["testProp"]
+      "additionalTestBlockFunctions": ["test.prop"]
    }
  ]
}

But unfortunately this doesn't work. Probably because with test.prop the test function is not actually contained within the parentheses of test.prop(...) and is instead contained within the parentheses of an anonymous function returned by test.prop.

I understand that test.prop is attempting to match test.each so maybe what we need to do is make a feature request for eslint-plugin-jest to support configuring test.each-like functions.

What do you think?

@TomerAberbach TomerAberbach changed the title Cannot configure eslint-plugin-jest's expect-expect rule to recognize test.prop Cannot configure eslint-plugin-jest's expect-expect and no-standalone-expect rules to recognize test.prop Nov 25, 2023
@TomerAberbach
Copy link
Sponsor Contributor Author

Realized that no-standalone-expect has the same issue. It has the same configuration options

@dubzzz
Copy link
Owner

dubzzz commented Nov 26, 2023

Indeed probably worth proposing that as an improvement of the eslint rules. 馃

@dubzzz
Copy link
Owner

dubzzz commented Nov 26, 2023

By the way, while test.prop seems more natural with Jest runner, I may have something 脿-la testProp (probably called fuzz) for vitest. The maintainers of vitest recommended to create a new name if I want to extend their runner.

@TomerAberbach
Copy link
Sponsor Contributor Author

Indeed probably worth proposing that as an improvement of the eslint rules. 馃

Did you want me to file the issue or did you want to do it? I'm good either way

@dubzzz
Copy link
Owner

dubzzz commented Nov 27, 2023

I prefer if you open it. You have more context on what you tried

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants