1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00
Files
tools/configs/oxlint/rules/vitest.md

724 B

vitest preset

Purpose

Правила для тестов (*.test.*, *.spec.*, test/**, __tests__/**).

Key Rules

  • vitest/no-conditional-tests.
  • vitest/no-import-node-test.
  • vitest/prefer-to-be-truthy, vitest/prefer-to-be-falsy.
  • vitest/prefer-to-have-length.
  • Relaxations: eslint/no-unused-vars и typescript/no-explicit-any выключены для тестов.

Examples

// ✅ Good
import { describe, it, expect } from 'vitest';

describe('list', () => {
  it('has items', () => {
    expect([1, 2, 3]).toHaveLength(3);
    expect(true).toBeTruthy();
  });
});

// ❌ Bad
if (process.env.CI) {
  it('conditionally runs', () => {
    expect(true).toBe(true);
  });
}