Jest patterns

From vladkesler/initrunner · View interactive version

Jest patterns is an AI agent skill from the GitHub repository vladkesler/initrunner. Jest and Vitest testing patterns including describe/it blocks, expect matchers, mocking, and async test strategies for JavaScript and TypeScript.

How to use this skill

Skill file

Jest and Vitest testing patterns for JavaScript and TypeScript projects.

When to activate

Use this skill when the project has jest.config.*, vitest.config.*,

a package.json listing jest or vitest as a dependency, or test files

matching *.test.{js,ts,tsx} or *.spec.{js,ts,tsx}.

Test file structure

describe a single behavior.

empty", ...) inside describe("parseConfig", ...)`).

setup like database connections.

Matchers

Mocking

with auto-mocked version.

method while keeping original implementation unless overridden.

return promises.

Async testing

await expect(fetchData()).resolves.toEqual(expected).

passes.

Running

MUST

vi.restoreAllMocks()).

MUST NOT

that is tedious to assert manually, not for every return value.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.