JoshuaKGoldberg / JoshuaKGoldberg/dot-com
🚀 Feature: Blog post on individual cases per test
- Dominant language
- MDX
- Stars
- 39
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
### Bug Report Checklist
- [x] I have tried restarting my IDE and the issue persists.
- [x] I have pulled the latest `main` branch of the repository.
- [x] I have [searched for related issues](https://github.com/JoshuaKGoldberg/dot-com/issues?q=is%3Aissue) and found none that matched my issue.
### Overview
Folks sometimes do this:
```js
it("works for xyz cases", () => {
expect(someLogic("x")).toBe(1);
expect(someLogic("y")).toBe(2);
expect(someLogic("z")).toBe(3);
})
```
Which is generally not a great testing thing: if an earlier assertion fails, then subsequent ones won't get run. That makes for not-very-informative test failures.
I generally prefer one assertion per test case, using `it.each` to generate tests if there are many similar cases.
### Additional Info
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.