Title here
Summary here
This rule disallows the use of an async function with describe. It usually indicates a copy/paste error or that you’re trying to use describe for setup code, which should happen in before or beforeEach. Also, it can lead to the contained it blocks not being picked up.
describe('the thing', async function () {
// This work should happen in a beforeEach:
const theThing = await getTheThing();
it('should foo', function () {
// ...
});
});
describe('something', async function () {
it('should work', function () {});
});
describe('something', async () => {
it('should work', function () {});
});
Caution
If the describe function does not contain await, a fix of removing async will be suggested. The rule won’t be able to detect the (hopefully uncommon) cases where the async function is defined before the describe call and passed by reference:
async function mySuite() {
it('my test', () => {});
}
describe('my suite', mySuite);