From 7d40a2cd56051ed56844d0f5bf02859ee40ac2c0 Mon Sep 17 00:00:00 2001 From: Anders Olsson Date: Fri, 5 Jun 2026 22:36:59 +0200 Subject: [PATCH] chore: use cargo-nextest as the test runner - .config/nextest.toml: hang-timeout profile (warn 60s, kill 120s) - justfile: 'just test' = cargo nextest run --workspace + cargo test --doc - CLAUDE.md: refresh stale Status + Commands for the real workspace + nextest 163 tests run in ~7s (vs multi-minute serial cargo test). Co-Authored-By: Claude Opus 4.8 (1M context) --- .config/nextest.toml | 11 +++++++++++ CLAUDE.md | 19 ++++++++++++------- justfile | 6 ++++-- 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 0000000..75acb9d --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,11 @@ +# cargo-nextest configuration. https://nexte.st/book/configuration +# +# nextest runs each test in its own process: live per-test output, and a hard +# per-test timeout so a genuinely wedged test is killed + named rather than +# stalling the whole run. + +[profile.default] +# Warn at 60s, terminate a test after 2×60s = 120s. The slowest real test is a +# couple of seconds (each #[sqlx::test] provisions its own temp DB), so this +# only ever fires on an actual hang. +slow-timeout = { period = "60s", terminate-after = 2 } diff --git a/CLAUDE.md b/CLAUDE.md index 1d85a44..502cd6d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,19 +4,24 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Status -Freshly scaffolded Rust binary crate (edition 2024). `src/main.rs` is still the `cargo new` "Hello, world!" stub and `Cargo.toml` has no dependencies yet. There is no architecture to document — update this file as real structure emerges. +Rust (edition 2024) workspace + React SPA collection-management system. Backend crates: `domain`, `db`, `api`, `auth`, `search`, `server` (axum 0.8 + sqlx/Postgres + Meilisearch). Frontend in `web/` (React 19 + Vite + pnpm). Tests need the docker-compose stack up (Postgres on **:5442**, Meilisearch on **:7700**); each `#[sqlx::test]` provisions its own temp DB. ## Commands ```bash -cargo build # build -cargo run # run the binary -cargo test # run all tests -cargo test # run a single test by name substring -cargo +nightly fmt # format — always nightly, not stable -cargo clippy # lint before committing +just check # fmt + lint + test — the standard pre-commit gate +docker compose up -d # start Postgres (:5442) + Meilisearch (:7700) for tests +cargo build --workspace # build +cargo run -p server # run the server (or: just run — loads .env) +cargo nextest run --workspace # run all tests — PREFERRED (per-test isolation, live output, hang timeouts) +cargo nextest run -E 'test()' # run tests matching a name substring +cargo test --workspace --doc # doctests (nextest does not run these) +cargo +nightly fmt # format — always nightly, not stable +cargo clippy --workspace --all-targets -- -D warnings # lint before committing ``` +(`just test` runs nextest + doctests; config in `.config/nextest.toml`.) + ## Conventions - **CLI args & env vars:** use `clap` with the `derive` feature. diff --git a/justfile b/justfile index 6570bb5..ec71caa 100644 --- a/justfile +++ b/justfile @@ -4,9 +4,11 @@ set dotenv-load run: cargo run -p server -# Run the full test suite +# Run the full test suite via cargo-nextest (per-test isolation, live output, +# hang timeouts). nextest does not run doctests, so they run separately. test: - cargo test --workspace + cargo nextest run --workspace + cargo test --workspace --doc # Format with the nightly toolchain fmt: