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

Rule proposal: Test function bodies should always be blocks #316

Open
raphinesse opened this issue Apr 18, 2021 · 1 comment
Open

Rule proposal: Test function bodies should always be blocks #316

raphinesse opened this issue Apr 18, 2021 · 1 comment

Comments

@raphinesse
Copy link
Contributor

Would there be interest in a rule that enforces that test function bodies always be blocks?

// BAD: Test function bodies should always be blocks (at 1:38)
it('should always use blocks', () => testSubject().then(
// ----------------------------------^
  result => expect(result).toBe(42)
));

// OK
it('should always use blocks', () => {
  return testSubject()
    .then(result => expect(result).toBe(42));
});

Implementation prototype with samples

@DianaSuvorova
Copy link
Collaborator

Yes! New rules are welcome!

I wouldn't include this one as an error for default configuration, but definitely would be a good contribution so people can decide if they want this as a convention for their projects.

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