noDoneCallback (since v1.6.1)
Diagnostic Category: lint/nursery/noDoneCallback
Sources:
- Same as:
jest/no-done-callback
Disallow using a callback in asynchronous tests and hooks.
This rule checks the function parameter of hooks & tests for use of the done argument, suggesting you return a promise instead.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-block.js:1:12 lint/nursery/noDoneCallback ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow using a callback in asynchronous tests and hooks.
> 1 │ beforeEach(done => {
│ ^^^^
2 │ // ...
3 │ });
ℹ Return a Promise instead of relying on callback parameter.
code-block.js:1:22 lint/nursery/noDoneCallback ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Disallow using a callback in asynchronous tests and hooks.
> 1 │ test('myFunction()', done => {
│ ^^^^
2 │ // ...
3 │ });
ℹ Return a Promise instead of relying on callback parameter.