Przejdź do treści
Biblioteka skilli
Programowanie · Testowanie

vitest

/vitest

Konwencje Vitest dla asercji, snapshotów i fixture'ów przy pisaniu, przeglądzie i naprawie testów.

Repozytorium
dotfiles ↗
Licencja
MIT
Ostatnia zmiana repozytorium
11.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
2
Przestarzałość

Brak sygnałów. Repozytorium zmienione 11.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Konwencje Vitest dla asercji, snapshotów i fixture'ów przy pisaniu, przeglądzie i naprawie testów.

Oryginalny opis (EN)

Vitest conventions for assertions, snapshots, and fixtures. Use when writing, reviewing, or fixing Vitest tests.

Jak działa

  1. Setup
  2. Readability
  3. Output
Sekcje z nagłówków SKILL.md, w oryginale · 51 linii, 304 słów
Podgląd SKILL.md
---
name: vitest
description: Vitest conventions for assertions, snapshots, and fixtures. Use when writing, reviewing, or fixing Vitest tests.
---

# Vitest Testing

Whether a test is worth writing is the `tdd` skill's call; this covers the
shape of Vitest tests. Each test should read as one behaviour, top to bottom,
without jumping to shared context.

## Setup

- Use Vitest APIs without imports only when runtime globals and their
  TypeScript declarations (`vitest/globals`) are configured; otherwise import
  what the file uses. See https://vitest.dev/config/globals.
- Use `vi.stubEnv()` with `unstubEnvs: true` or `vi.unstubAllEnvs()` cleanup
  rather than mutating `process.env`; avoid dynamic
  `import()` unless dynamic loading is the behaviour under test.
- Run the repository’s Vitest command with `--changed` during a cycle; see https://vitest.dev/api/test
  for modifiers (`it.todo`, `it.fails`, `it.each`, …).

## Readability

- One behaviour per `it`, named for what a caller observes.
- Expected failures use `expect(...).toThrow()` / `.rejects`, not `try`/`catch`.
- No `if` in test bodies: split the test, or use `it.each` when cases share one
  behaviour.
- KISS over DRY: repeat setup and write concrete values inline when that reads
  better. Helpers are for genuinely noisy fixtures, and assertions stay in the
  test.
- Narrow nullable values with `assert` instead of non-null assertions.

```ts
it('returns the first row', () => {
	const firstRow = getRows()[0];
	assert.isDefined(firstRow, 'expected at least one row');

	expect(firstRow.id).toBe('row-1');
});
```

## Output

Prefer JSON assertions for structured results. Do not write snapshot tests
(`toMatchSnapshot`, `toMatchInlineSnapshot`, `toMatchFileSnapshot`): nobody
reviews snapshot diffs, so they get regenerated rather than read and catch
nothing. For CLI or table output, assert the lines that matter with explicit
matchers, and fix the terminal width for responsive output.

The exception is a code generator whose output is the product: commit the
generated file with `toMatchFileSnapshot` in its real extension (`Output.swift`,
not `.snap`), so a PR reviews it as code, and check it with the target
toolchain (compile or type-check it) so the file is verified, not just recorded.

Wersje

RepozytoriumWynikLicencja
Ta strona · ryoppippi/dotfiles100MIT
TerminalSkills/skills100Apache-2.0
zenobi-us/dotfiles100MIT
itechmeat/llm-code100MIT
claude-dev-suite/claude-dev-suite100MIT
jezweb/claude-skills100MIT
G1Joshi/Agent-Skills100MIT
pproenca/dot-skills100MIT
el-feo/ai-context100MIT

Migawka bazy z 13.11.2026 · wersja paczki de81cd6c7da6 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100vitest-v4
    Doradza przy pisaniu testów w Vitest v4 dla projektów React i Next.js: pokrycie, debugowanie testów i mocki funkcji.
  • 100vitest-test-creator
    Prawdopodobnie tworzy testy Vitest w ramach automatyzacji testów.
  • 100vitest-testing
    Pisze i przegląda testy Vitest z jasnymi asercjami o zachowaniu, odpowiednimi importami, snapshotami plikowymi dla wyjścia terminala i czytelnymi fixture'ami.
  • 90vitest-guide
    Pomaga pisać testy w Vitest 3 w TypeScript: mocki, asercje HTTP, testy CORS i poprawność typów w testach.
  • 100vitest-best-practices
    Podaje wzorce testów w Vitest: strukturę AAA, testy parametryzowane, asercje, mocki, obsługę błędów i wydajność.
  • 100vitest-testing
    Stosuje wzorce i dobre praktyki Vitest: testy jednostkowe i integracyjne, vitest.config, mocking przez vi.mock i vi.fn, snapshoty i pokrycie.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.