vitest/valid-describe-callback

January 2, 2026 ยท View on GitHub

๐Ÿ“ Enforce valid describe callback.

๐Ÿ’ผโš ๏ธ This rule is enabled in the โœ… recommended config. This rule warns in the ๐ŸŒ all config.

This rule validates the second parameter of a describe() function is a callback.

  • should not contain parameters
  • should not contain any return statements

The following are considered warnings:

// callback function parameters are not allowed
describe('myfunc', (done) => {
  //
})

describe('myfunc', () => {
  // no return statements are allowed in a block of a callback function
  return Promise.resolve().then(() => {
    //
  })
})

// returning a value from a describe block is not allowed
describe('myfunc', () =>
  it('should do something', () => {
    //
  }))

The following are not considered warnings:

describe('myfunc', async () => {
  //
})
describe('myfunc', () => {
  it('should do something', () => {
    //
  })
})