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
feat(rules): add require-top-level-describe rule #407
feat(rules): add require-top-level-describe rule #407
Conversation
Thanks! Ignore CI, the commitlint thing is somewhat broken. I should look into it at some point... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add it to the main readme as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny coverage issue from CI, otherwise this LGTM. Super contribution, thank you!
return; | ||
} | ||
|
||
if (isHook(node)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI complains that this is not covered. Maybe the else
branch? A test with a CallExpression
inside a describe
that's neither a test nor a hook should probably hit it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! I added a dummy test in the valid cases to fix it:
'foo()',
But thinking of it, should we trigger a warning if the user uses a CallExpression
that's neither a test or a hook or can we leave it as is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, that's fine, I think. Jest itself uses it to e.g. skip tests on windows, or run some other sort of helper 🙂
🎉 This PR is included in version 22.16.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR intends to add a new ESLint rule which enforces the user to add a top-level
describe
in their test files.Closes #401