Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 469 Bytes

File metadata and controls

32 lines (26 loc) · 469 Bytes

vitest/prefer-hooks-in-order

📝 Enforce having hooks in consistent order.

⚠️ This rule warns in the 🌐 all config.

// consistent order of hooks
;['beforeAll', 'beforeEach', 'afterEach', 'afterAll']
// bad
afterAll(() => {
  removeMyDatabase()
})
beforeAll(() => {
  createMyDatabase()
})
// good
beforeAll(() => {
  createMyDatabase()
})
afterAll(() => {
  removeMyDatabase()
})