This rule raises an issue when the callback passed to describe(), or one of its aliases or variants, is declared async.

Why is this an issue?

Test frameworks like Jest, Mocha, and Cypress run a suite’s callback during the discovery phase, before any test executes, so they can collect the test cases nested inside it. The framework expects this callback to be a synchronous function and does not await the promise an async callback returns.

This applies to every suite-defining form whose callback runs during discovery, grouped here by the frameworks that provide it:

An async callback breaks in two ways depending on its body.

The callback awaits before registering tests. The framework runs the synchronous portion of the callback, registers whatever was scheduled before the first await, and moves on. Any it() declared after that await is registered too late and is silently skipped. The reported test counts can look fine even though tests the developer intended to run never execute.

Keep test registration on the synchronous discovery path: move the awaited work into a lifecycle hook the framework awaits, or into the individual test bodies, so that every it() is reached before any await. This applies to awaits hidden in helper functions the callback calls too: making only the suite callback synchronous is not enough if a helper it calls still awaits between its own it() registrations.

describe('user service', async () => { // Noncompliant: an async suite callback is not awaited, so tests after the await are skipped
  const config = await loadConfig();

  it('returns users', () => { // never registered
    expect(listUsers(config)).toEqual(['alice', 'bob']);
  });
});
describe('user service', () => { // Compliant: the suite callback is synchronous
  let config;

  beforeEach(async () => { // async work moved into a hook the framework awaits
    config = await loadConfig();
  });

  it('returns users', () => {
    expect(listUsers(config)).toEqual(['alice', 'bob']);
  });
});

The callback does not await anything. All tests still register, but the async keyword is misleading and makes the callback return a promise that the framework silently ignores. Remove async to make the callback synchronous.

describe('user service', async () => { // Noncompliant: the suite callback is async but awaits nothing, so async is misleading
  it('returns users', () => {
    expect(listUsers()).toEqual(['alice', 'bob']);
  });
});
describe('user service', () => { // Compliant: the suite callback is synchronous
  it('returns users', () => {
    expect(listUsers()).toEqual(['alice', 'bob']);
  });
});

Exceptions

The rule does not raise on the skip variants, such as describe.skip(), context.skip(), suite.skip(), xdescribe(), describe.skip.each(), and xdescribe.each(). The suite callback still runs during discovery, but because the tests it contains are skipped regardless, an async callback there cannot cause tests that were meant to run to be silently dropped.

Resources

Documentation