Skip to content

Commit e2fffbb

Browse files
Testing README edit suggestions (#68)
1 parent f1cd11b commit e2fffbb

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

testing/README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22

33
## Philosophy
44
* Test code is a first-class part of the deliverable, not an optional nice-to-have.
5-
* When scopeing / estimating work: always factor in testing.
6-
* Untestable code = bad code.
7-
* Insufficent test coverage is better than no test coverage.
8-
* Additional history and guiding principles are in [this "manitesto" doc](https://bitbucket.org/blog/save-time-with-default-pull-request-descriptions)
5+
* When scoping / estimating work: always factor in testing.
6+
* Testability is an attribute of good code. Code that cannot be tested is a problem.
7+
* Insufficient test coverage is better than no test coverage.
8+
* Prefer [Use Case Coverage over Code Coverage](https://kentcdodds.com/blog/how-to-know-what-to-test) (no need for 100% code coverage).
9+
* Additional history and guiding principles are in [this "manifesto" doc](https://docs.google.com/document/d/1XWx0GZLndtPF4-cwBeHii85osRj0ROPrflBF3DAVewA/edit)
910

1011
## Best Practices & Standardization
1112

1213
### General
1314
* Organization of `scripts` in package.json:
14-
- `test` = runs all unit tests + E2E tests in headless mode
15+
- `test` = runs all unit/integration/E2E tests in headless mode
1516
- `test:watch` = same as `test` but with Jest in watch mode
16-
- `cypress` = run cypress with the dashboard open
17+
- `cypress` = run Cypress with the [Cypress Test Runner](https://docs.cypress.io/guides/guides/command-line.html#cypress-open)
1718
- `check-lint` = runs style lint, eslint, prettier
1819
- `lint` = same as `check-lint` but writes the changes (`--fix`)
1920
- `ci` = run EVERYTHING
20-
* Try to minimize nesting and coupling. These make tests brittle and hard to maintain.
21+
* [Apply the AHA principle](https://kentcdodds.com/blog/avoid-nesting-when-youre-testing). Try to minimize nesting, coupling and over-abstraction. These make tests brittle and hard to maintain.
2122

2223
### Jest
2324
* Unit test files for components should be siblings in the same directory with a `.test.js` suffix. Placing test code close to application code is intended to encourage testing and make it harder to forget.
24-
* For the test name, prefer the `it('does something')` sytnax because it is more self-documenting and intuitive
25+
* For the test name, prefer the `it('should do something')` syntax because it is more self-documenting and intuitive
2526
* Use `describe()` and `beforeEach` sparingly. They lead to nesting and coupling.
2627

2728
### Testing Library
@@ -30,7 +31,7 @@
3031
* We encourage using the `screen` object exported by Testing Library because the resulting idioms will be more similar in React and Vanilla JS projects. [1](https://testing-library.com/docs/queries/about#screen), [2](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen).
3132

3233
## Favorite Tools
33-
* Unit testing: Jest + Testing Library
34+
* Unit/integration testing: Jest + Testing Library
3435
* E2E testing: Cypress
3536

3637
## Resources

0 commit comments

Comments
 (0)