Skip to content

Quick Start

Pick your test runner. Both paths use the default SQLite store and capture failures locally in under two minutes.

  1. Install the plugin and a store

    Terminal window
    bun add -D @flaky-tests/plugin-bun @flaky-tests/store-sqlite

    Store adapters ship as optionalDependencies of the plugin, so you install only the one you use. The default preload resolves FLAKY_TESTS_STORE (defaults to sqlite) at startup.

  2. Add the preload to bunfig.toml

    [test]
    preload = ["@flaky-tests/plugin-bun/preload"]

    That’s it. The next time you run bun test, failures are captured automatically.

  3. Run your tests

    Terminal window
    bun test

    Failures are written to node_modules/.cache/flaky-tests/failures.db. Nothing else changes — tests still pass and fail as normal.

  4. Check for flaky patterns

    After a few runs (or in CI after a few days):

    Terminal window
    bunx @flaky-tests/core

    If new patterns are detected you’ll see something like:

    ✗ 1 new flaky test pattern detected
    1. auth > login > should redirect on success
    tests/auth.test.ts · timeout · 8 fails in 7d
    Expected redirect within 2000ms
    Run with --prompt to print investigation prompts
  5. Generate an investigation prompt

    Terminal window
    bunx @flaky-tests/core --prompt

    Copy the output into Claude, Cursor, or Copilot to investigate.

Typing bunx / npx each time gets old. Install the CLI as a dev dependency and add scripts so the whole team runs the same invocation:

Terminal window
npm i -D @flaky-tests/core
package.json
{
"scripts": {
"flaky": "flaky-tests",
"flaky:prompt": "flaky-tests --prompt",
"flaky:report": "flaky-tests --html"
}
}

Now anyone on the project can run bun run flaky (or npm run flaky / pnpm flaky / yarn flaky) without reaching for the full package name, and CI workflows get a single stable command to call.