-
Notifications
You must be signed in to change notification settings - Fork 227
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
[require-hook
] Add option to allow class calls
#1386
Comments
Is there a reason why you're running this rule against your file if you have this custom extension? I'm not against adjusting the options to make the rule more flexible, but would like to understand more of your use-case first since I'm not sure why (or how) you'd want mix test cases with this (which is really when the result is needed - even if you're using things like |
Yeah, I could disable this per-file in the config, that's true... I could also use disable comments. However, I expect to have more tests in more files that do not all use the class, so specifying which files to apply the rule to and which not would be a kind of pain... Also you may want to use such a tester and then add some more tests manually in the same file, in which case you really have to use disable comments - I am not sure I'll be in such a scenario, but it's another option that comes to mind... |
Hi,
I have a lot of tests that are really similar, so I built a class that scaffolds all the tests and invoke it in my test file like so:
However, this triggers
jest/require-hook
. In that rule, there is theallowedFunctionCalls
option. However, when I printedgetNodeName(node)
here, I gotNodeExtensionTester.shouldMatchUnistNode.shouldNotMatchUnistNode.shouldNotMatchUnistNode.runTests
... which is ugly and depends on all the methods called, so there's not really any point to using
allowedFunctionCalls
for this (instead of disable comments or disabling the rule altogether)Could we add something like
allowedClasses
?The text was updated successfully, but these errors were encountered: