Skip to content

Instantly share code, notes, and snippets.

@samhstn
Last active January 7, 2017 18:55
Show Gist options
  • Save samhstn/375b58d208bc564dde13d362ffdb5c96 to your computer and use it in GitHub Desktop.
Save samhstn/375b58d208bc564dde13d362ffdb5c96 to your computer and use it in GitHub Desktop.
The uses of `t.plan`
```
test(‘test it errors at some point’, (t) => {
asyncEvent(‘data that will error’, (err, cb) => {
if (err) {
t.ok(err);
t.end();
}
anotherAsyncEvent((err, cb) => {
if (err) {
t.ok(err);
t.end();
}
});
});
});
```
is not as nice as:
```
test(‘test it errors at some point’, (t) => {
t.plan(1);
asyncEvent(‘data that will error’, (err, cb) => {
if (err) {
t.ok(err);
}
anotherAsyncEvent((err, cb) => {
if (err) {
t.ok(err);
}
});
});
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment