agentleFS
bInference-LabbInference-Lab/bInference/.agents/skills/run-tests/SKILL.md

run-tests

Skill2 starsChanged 2 days agoMITView on GitHub

Picks the tests that prove a change, runs them at a low worker count, and says where each kind of test lives. Use while writing or fixing code, before clean-diff, and when a test fails.

53 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use detect-static-dependencies, filter-syntax and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    detect-static-dependencies

    ACTIVATION PREREQUISITE: the request or discovered target must explicitly identify C#, .NET, `.cs`, or `.csproj`; otherwise stay dormant without invoking this skill. USE FOR: locating System.DateTime.Now/UtcNow, System.IO.File/Directory, System.Environment, HttpClient, Console, or Process usage in C#; auditing C# code for hard-to-test framework dependencies; or verifying those C# calls are already abstracted. DO NOT USE FOR: any target lacking the activation prerequisite; generating wrappers (use generate-testability-wrappers); migrating code (use migrate-static-to-wrapper); or general code review.

    Also in 3 projects that use this

  • MicrosoftSkill

    filter-syntax

    Reference-only filter syntax for VSTest and MTP with MSTest, NUnit, xUnit v3, and TUnit. Load only after the platform/framework is known and a consumer needs to create or translate a filter. Do not load for unfiltered runs or platform detection. Used by run-tests and mtp-hot-reload; never invoke directly.

    Also in 3 projects that use this

  • ShopifySkill

    prepare-release

    Prepare the changeset-release/main branch for release by syncing version.ts files and running pnpm install

    Also in 3 projects that use this

  • SentrySkill

    create-pr

    Create pull requests following Sentry conventions. Use when opening PRs, writing PR descriptions, or preparing changes for review. Follows Sentry's code review guidelines.

    Also in 5 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 4 projects that use this

  • +7 more from microsoft

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 48 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep --maxWorkers=2 on a laptop that others share.

    line 54
  2. Distinctive:

    Read the assertion and the first stack frame in our code.

    line 85
  3. Very specific:

    Run the failing test, then its folder, then pnpm check once at the end.

    line 90
  4. Very specific:

    No network (a refusing dispatcher is installed), no real timers, no sleeps, no polling.

    line 95
  5. Very specific:

    No conditional tests or expects, no .only or .skip, every expect awaited.

    line 97

“Common” is measured: kept by at least 6 in 10 of the 48 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Run the tests

A change is proven by the cheapest test that would fail without it. Run that test while you work, and the full pnpm check once, when the change is complete.

1. Know the kinds

KindWhere it livesHow it runs
Unit<pkg>/src/**/<module>.test.ts, beside the codepnpm vitest run <path>
Chinese<module>.zh.test.ts: text a person reads in zhpnpm vitest run <path>
Contractsrc/contracts/<port>-contract.ts, one per portfrom each adapter's own test
Property<module>.property.test.ts, fast-checkpnpm vitest run <path>
End to endsrc/e2e/: a real process or the composed enginepnpm vitest run <path>
Forksrc/fork/: anvil on a fork of BSCpnpm test:fork <path>
Crashsrc/crash/: kills and restarts an enginepnpm test:crash <path>
Imagesrc/image/: builds and runs the Docker imagepnpm test:image
MutationStryker over engine and signerCI only; never in a task's loop

pnpm check and pnpm test skip the fork, crash and image folders. Those suites run each night in CI. The image suite needs Docker; run it by hand, alone, after a change to the Dockerfile, .dockerignore or how the binference package is built.

2. Pick the proof

  • A pure function or a rule: a unit test in the module's own test file.
  • A policy or amount module (policy/*.ts, *amount*.ts): also a property test beside it; check:layout fails without one.
  • A new port: a contract suite named <port>Contract, exported from a *-contract.ts file, and a hand-written fake in src/fakes/ whose test runs the suite. Every adapter's test runs it too. check:contract-suites checks both.
  • A fake in a test: use the package's testing export (@binference/<pkg>/testing), never vi.mock in a pure package.
  • A wiring change across packages: a test in packages/cli/src/compose/ on the test composition.
  • A chain call, a venue's contract or a registry address: a fork test.
  • A step between signing and receipt: a crash test.
  • A bug: a test that fails on the old code for the reason the bug names. Keep the failing run for the pull request's evidence.

3. Run it

pnpm vitest run packages/engine/src/limits --maxWorkers=2
pnpm vitest run packages/engine/src/limits/limit-handlers.test.ts -t "<test name>"
pnpm test:fork plugins/kyberswap/src/fork
BINFERENCE_CRASH_RUNS=1 pnpm test:crash packages/cli/src/crash
  • Keep --maxWorkers=2 on a laptop that others share. One test command at a time; never two Vitest runs side by side.
  • A crash pass prints its runs per kill point, its kill points, its estimated time and its results file in reports/crash/, which gets each run's result as the run ends: read it while a long pass runs, or after one was stopped. A part estimated over 120 minutes is refused. After a change to a kill point's speed or a new kill point, refresh the times: run the changed file at BINFERENCE_CRASH_RUNS=1, then pnpm crash:times reports/crash/<file>.jsonl.
  • The fork and crash suites need anvil on the PATH. The fork suite also reads public BSC nodes, which refuse bursts for a while: a 403 there is the network, not your code.
  • A test command that runs past a minute is a finding. Stop it and find out why before running it again (see speed-up-tests).

4. After a merge

The merger runs the after-merge set on master after each merge:

pnpm test:after-merge                  # what the last merge brought, ORIG_HEAD..HEAD
pnpm test:after-merge master@{1}..master
pnpm test:after-merge <base>..<head> --list

It runs the tests of every package the range changed and of every package that depends on one, the table tests that read every notice key, card key and reason code (a key added without its rows in another package's table fails only here), the repo checks two merged branches can break together, on half the cores, and check:gates when a gate's script or config changed. --list prints what it chose and why without running it. A new test that reads a whole catalog of another package joins its list in scripts/after-merge/after-merge-plan.mts.

5. When a test fails

  1. Read the assertion and the first stack frame in our code. Run that one test alone.
  2. Decide which side is wrong: the code, the test, a fake that drifted from its contract, or the machine. A test that passes alone and fails in the full run leaves state behind: files share their worker's modules, so a stub or a global must come back after each test.
  3. Fix the cause. Never add a retry, a longer timeout, a sleep or a looser assertion to get green.
  4. Run the failing test, then its folder, then pnpm check once at the end.

6. Rules every test keeps

  • Names are sentences in lowercase with no period: rejects a swap above the daily cap.
  • No network (a refusing dispatcher is installed), no real timers, no sleeps, no polling. Time comes from a fake Clock.
  • No conditional tests or expects, no .only or .skip, every expect awaited.
  • The 30-second test timeout catches a hang. Never raise it for a slow test; make the test faster.

7. Report

Name the tests you added or changed, the commands you ran and what they showed.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.