/javascript:typescript-testingfrom javascript
Use whenever you write, fix, review or debug TypeScript or JavaScript tests (*.test.ts, *.spec.ts, vitest.config.ts), including flaky, slow or hanging tests, tests that sleep, mock modules, use snapshots or hit the network, and adding tests for a function, a retry or an HTTP client. Vitest, table tests with test.for, hand-written fakes over vi.mock, fake timers, MSW, snapshot discipline.
Ships in javascript. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
retry.ts, retry.test.ts); fakes shared by several features go in src/testing/. make test runs the unit project of the config with coverage, in shuffled order: an order dependence is a bug, not a flake.as, no any); the one relaxation is @ts-expect-error with a description, to test what a caller without types could pass.test.for table tests while preserving all test cases and edge conditions. Remove sleeps and fixture bloat.Vitest 5 is the runner for every package, with the config in references/vitest.config.ts: it runs TypeScript as written (parameter properties included), has fake timers, coverage and type tests, and shares the Vite config of a React app. node:test only for a dependency-free script that Node runs as .ts directly; nothing else mixes runners. Jest is not added to new code.
test, never it (lint enforces it); describe only to share setup, not to mirror the file.toStrictEqual over toEqual (it checks undefined keys and classes; lint enforces it). Expectations on promises are awaited: await expect(p).rejects.toThrow(...).test.concurrent / describe.concurrent for async I/O tests. Ensure concurrency safety: isolate mock state, use port 0 for servers, stub environment with vi.stubEnv rather than direct mutation.test.fails('reproduction: ...', () => { ... }) or test.todo('...'). Vitest fails when a test.fails passes unexpectedly, ensuring the driver removes test.fails once the source fix is in place. No .only, no .skip in a commit (lint enforces both).test.for([...])('%s', ([input, want]) => ...) for one behaviour over many inputs, typed through its generic (test.for<[Input, string]>). A row that needs different setup or assertions is a separate test.vi.mock and vi.doMock are banned by lint: they test the import graph, and the code under test should take the dependency as a parameter instead. vi.fn() only stands in for a callback whose calls are the behaviour.fs.mkdtemp(os.tmpdir()), a real node:http server on port 0 for server code, a real child process for process code. MSW (setupServer from msw/node) for code that calls an HTTP API: the request leaves fetch for real, and an unhandled request fails the test.vi.stubEnv and vi.stubGlobal instead of assigning to process.env or globals (the config restores them), and every server or temp dir is closed in afterEach/afterAll.vi.useFakeTimers() in beforeEach, vi.useRealTimers() in afterEach) for anything with delays, timeouts, backoff or Date.now(). Advance with the async APIs (vi.advanceTimersByTimeAsync, vi.runAllTimersAsync), which let awaited callbacks run between timers; the sync ones are banned by lint.expect.poll(...) and a deadline.now: () => Date) where a timestamp is part of the output (records, logs, snapshots).toMatchFileSnapshot('__snapshots__/<name>.json') or a short toMatchInlineSnapshot(), scrubbed of ids and times. Never snapshot a component tree or an error stack. Review snapshot diffs like code; vitest -u is not a fix.fc.assert(fc.property(arbitrary, input => ...)) asserting properties (never throws, round-trips, rejects what it should). A counterexample becomes a plain regression test.expectTypeOf in *.test-d.ts, which the unit project type-checks.*.int.test.ts: the integration project, run by make test-integration in CI's full tier (ci-cd), not by make test.Read references/PATTERNS.md for a table test, compacting repetitive tests, concurrent table tests, bug reproduction with test.fails, a fake, fake-timer backoff, an MSW client test and a fast-check property, all run with Vitest 5.1.
vi.useFakeTimers() patches the globals only: setTimeout from node:timers/promises and AbortSignal.timeout() keep running on real time. Code that must be testable sleeps through the global setTimeout; a test passes an AbortController signal and aborts it itself.await Promise.all([expect(p).rejects.toThrow(...), vi.runAllTimersAsync()]), not the expectation after the advance.server.listen({onUnhandledFrame: 'error'}); the v2 onUnhandledRequest no longer type-checks.toMatchObject and expect.objectContaining pass with extra keys: use them only where extra keys are allowed by design.--coverage, v8) is reported, never gated (org standard, as in Go): a threshold rewards tests that execute lines without asserting.vitest run, which exits.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub giocaizzi/harness --plugin javascriptOther plugins' skills for the same job
5 skills in this plugin
/atomic-designUse when extracting shared components or layouts, structuring a UI kit or component folders, deciding where a component goes, or adding lint rules for import boundaries (feature to feature, UI kit to features, layers, cycles). Atomic design./javascript-typescriptUse whenever you write, change or review .ts, .tsx or .js code, a package.json, tsconfig.json or eslint.config.js, whether adding a function or feature, fixing a bug, refactoring, scaffolding a package or reviewing before a merge, even when the user does not mention conventions. House rules: TypeScript 7, Node 26, pnpm, ESLint 10, strict tsconfig, no any or enums, zod at the boundaries./nextjs