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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support function calls as custom names (to stop false warnings) #336

Merged

Conversation

scottmcginness
Copy link
Contributor

Call expressions can have a name when getting the node. Fixes #335

There might have been better ways to achieve this, but this looked like the most straightforward.

In particular:
  * mocha-each style `forEach` prefix now does not have an error reported on its nested hooks,
  * additional custom names chained off describe/context can work, in line with how .only and .skip work,
  * the combination of the above, where there is a function call chained directly off describe/context.
This way is slightly more explicit and allows top-level to distinguish between the call of the custom function and the call of the function that's returned.
For example, forEach([1, 2, 3]).describe fails the max-top-level-suites rule if it contained more than one nested suite.
Updates tests to match the new setting names.
Add more tests to guard against regressions (some of these were already supported, such as dotted properties, but not explicitly so).
Link to mocha-each as an example for custom naming.
Add examples of the kinds of names that may be added.
Copy link
Owner

@lo1tuma lo1tuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@lo1tuma lo1tuma merged commit 4985064 into lo1tuma:master Sep 20, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support function calls as custom names (to stop false warnings)
2 participants