Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixing linting issues in doc
  • Loading branch information
Bamieh committed Dec 14, 2017
commit 85f8194d4e198c53f97e1b80101941790bbe3f01
15 changes: 10 additions & 5 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ platforms.

### The *common* API

Make use of the helpers from the `common` module as much as possible. Please refer to the [common file documentation](https://github.com/nodejs/node/tree/master/test/common) for the full details of the helpers.
Make use of the helpers from the `common` module as much as possible. Please refer
to the [common file documentation](https://github.com/nodejs/node/tree/master/test/common)
for the full details of the helpers.

#### common.mustCall

One interesting case is `common.mustCall`. The use of `common.mustCall` may avoid the use of extra variables and the corresponding assertions. Let's explain
this with a real test from the test suite.
One interesting case is `common.mustCall`. The use of `common.mustCall` may avoid
the use of extra variables and the corresponding assertions. Let's explain this
with a real test from the test suite.

```javascript
'use strict';
Expand Down Expand Up @@ -192,9 +195,11 @@ const server = http.createServer(common.mustCall(function(req, res) {
```
#### Countdown Module

The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module) provides a simple countdown mechanism for tests that require a particular action to be taken after a given number of completed tasks (for instance, shutting down an HTTP server after a specific number of requests).
The common [Countdown module](https://github.com/nodejs/node/tree/master/test/common#countdown-module) provides a simple countdown mechanism for tests that
require a particular action to be taken after a given number of completed tasks
(for instance, shutting down an HTTP server after a specific number of requests).

```
```javascript
const Countdown = require('../common/countdown');

const countdown = new Countdown(2, function() {
Expand Down