Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.06 KB

no-focused-tests.md

File metadata and controls

54 lines (40 loc) · 1.06 KB

Disallow focused tests (vitest/no-focused-tests)

⚠️ This rule warns in the 🌐 all config.

🔧 This rule is automatically fixable by the --fix CLI option.

Rule Details

Examples of incorrect code for this rule:

it.only('test', () => {
	// ...
})

test.only('it', () => {
	// ...
})

Examples of correct code for this rule:

it('test', () => {
	// ...
})

test('it', () => {
	/* ... */
})

Options

This rule has a fixable option that tells the plugin to automatically fix the tests for you. The option is enabled by default. You can disable it in your eslint.config.js file using the following configuration.

import vitest from 'eslint-plugin-vitest'

export default [
  {
    files: ['**/*.ts', '**/*.js'], // or any other pattern
    plugins: {
      vitest,
    },
    rules: {
      ...vitest.configs.recommended.all,
      'vitest/no-focused-tests': ['error', { 'fixable': false }]
    }
  }
]