Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.14 KB

300-testing-vitest.md

File metadata and controls

42 lines (32 loc) · 1.14 KB
Error in user YAML: (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 2 column 8
---
description: Apply these testing rules when verifying or writing new test suites to ensure quality and coverage
globs: **/*.test.ts
alwaysApply: false
---

Testing Standards

blefnk/rules 1.0.0

Context

  • Ensures consistent testing conventions for unit and integration tests
  • Uses vitest for all test files matching **/*.test.ts

Requirements

  • Use Vitest as the testing framework.
  • Group related tests logically (describe blocks).
  • Write clear, atomic assertions; avoid chaining multiple, unrelated checks in one test.
  • Test only critical logic or components; avoid trivial or redundant tests.
  • Give each test a descriptive name that clarifies its purpose and expected outcome.

Examples

import { describe, it, expect } from "vitest";

describe("Button component", () => { it("renders with default props", () => { const result = renderButton(); // Pseudocode expect(result).toContain(""); }); });

test("Test all app logic in one big function", () => { // Overly broad testing, unclear assertions });