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 no-test-return-statement
#136
Conversation
What about |
If that should be allowed, let's call it |
Yeah that should be allowed, I'll update the name :) |
cd99d8e
to
1a53389
Compare
README.md
Outdated
@@ -90,6 +90,7 @@ for more information about extending configuration files. | |||
| [no-jest-import][] | Disallow importing `jest` | ![recommended][] | | | |||
| [no-large-snapshots][] | Disallow large snapshots | | | | |||
| [no-test-prefixes][] | Disallow using `f` & `x` prefixes to define focused/skipped tests | | ![fixable-green][] | | |||
| [no-test-return-statement][] | Disallow returning from tests | | | |
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.
"Disallow explicitly returning from tests"?
@@ -0,0 +1,47 @@ | |||
# Disallow returning from tests (no-test-return-statement) | |||
|
|||
Tests in Jest are void and cannot return values. |
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.
"should be"? Seeing as you can return a promise, and that's unlikely to change (I don't think it's possible to differentiate between an async
function and a promise-returning one (at least not if it's transpiled))
1a53389
to
dc90b5f
Compare
/cc @aaronabramov FYI |
no-test-return
no-test-return-statement
dc90b5f
to
42409b6
Compare
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.
SGTM
🎉 This PR is included in version 21.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds a rule for not returning inside of a test. Related issue in Jest: jestjs/jest#6516