mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 00:28:25 -05:00
Merge pull request #562 from airbnb/ljharb/testing
Start to write a realistic "testing" section
This commit is contained in:
12
README.md
12
README.md
@@ -2015,14 +2015,22 @@ Other Style Guides
|
||||
|
||||
## Testing
|
||||
|
||||
- [28.1](#28.1) <a name='28.1'></a> **Yup.**
|
||||
- [28.1](#28.1) <a name="28.1"></a> **Yup.**
|
||||
|
||||
```javascript
|
||||
function() {
|
||||
function () {
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
- [28.2](#28.2) <a name="28.2"></a> **No, but seriously**:
|
||||
- Whichever testing framework you use, you should be writing tests!
|
||||
- Strive to write many small pure functions, and minimize where mutations occur.
|
||||
- Be cautious about stubs and mocks - they can make your tests more brittle.
|
||||
- We primarily use [`mocha`](https://www.npmjs.com/package/mocha) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules.
|
||||
- 100% test coverage is a good goal to strive for, even if it's not always practical to reach it.
|
||||
- Whenever you fix a bug, _write a regression test_. A bug fixed without a regression test is almost certainly going to break again in the future.
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user