javascript-testing-expert_skill

This skill helps you write high-quality JavaScript tests using property-based testing to uncover bugs, document usage, and prevent regressions.
  • TypeScript

4.8k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill dubzzz/fast-check --skill javascript-testing-expert

  • SKILL.md15.7 KB

Overview

This skill is an expert JavaScript testing assistant focused on writing high-quality unit and component tests that find bugs, document behavior, and prevent regressions. It emphasizes property-based testing with fast-check and defends tests against indeterministic code. It does not cover black-box end-to-end testing.

How this skill works

I inspect the code structure and existing test layout, then produce tests colocated and named to match your repository conventions (.spec.ts preferred). I recommend and adapt to tooling like vitest, fast-check, @fast-check/vitest, testing-library, msw and browser-playwright, and I generate example-based tests first followed by property-based tests for invariants and edge cases. I also flag test smells (excessive parameters, unstable values, network usage) and propose focused fixes or helpers.

When to use it

  • When you need tests that act as documentation for function or component behavior
  • When you want to find edge-case bugs that example tests miss using property-based testing
  • When code under test is asynchronous or could suffer race conditions
  • When tests are flaky due to indeterministic behavior (time, randomness, network)
  • When a function is hard to test and you want a signal to refactor for single-responsibility

Best practices

  • Mimic existing test structure and colocate one .spec.ts per source file, using describe per function and it starting with "should"
  • Follow Arrange-Act-Assert (AAA) visibly in every it block and keep assertions focused and minimal
  • Use real, realistic data for documentation-like tests and extract complex logic into testable small functions
  • Favor stubs over mocks and never rely on network calls; use msw for HTTP stubbing
  • Prefer property-based tests (fast-check) for "always/never" guarantees and use @fast-check/vitest integration when available
  • Avoid heavy logic inside tests and warn when a function needs more than ~10 parameters or many mocks — recommend SRP refactor

Example use cases

  • Write a suite for a date utility: simple examples plus property tests ensuring invariants across many dates and controlled system time
  • Create tests for an async queue using fast-check scheduler to detect race conditions
  • Add component tests that assert DOM structure and interactions with testing-library, plus optional screenshot/browser tests for visual regression
  • Convert a brittle example test relying on randomness into a deterministic property-based test with faker wired into fast-check
  • Replace network-dependent tests with msw-based stubs and add both example and property tests for edge-cases

FAQ

I highly recommend installing fast-check; prefer @fast-check/vitest when using vitest for tighter integration, but I can adapt if only fast-check is available.

Will you write end-to-end black-box tests?

No. This skill focuses on unit and component-level testing, properties and race conditions, not black-box e2e testing.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
javascript-testing-expert skill by dubzzz/fast-check | VeilStrat