From 84843c1c254044fa5b2a764704e83ad067361917 Mon Sep 17 00:00:00 2001 From: Cameron Cordes Date: Tue, 13 Oct 2026 11:09:14 -0400 Subject: [PATCH] docs: run tests with an in-memory DATABASE_URL The docs said tests need BASE_PATH in .env. The full suite (lib, bin and integration tests) passes with no .env and no BASE_PATH; the only thing it needs is DATABASE_URL, and ":memory:" works. Without it, DB-backed tests such as reels::tests::reel_capture_preserves_owner_defaults panic with "DATABASE_URL must be set". Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 10 +++++----- README.md | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 7d9d3e0..72d25b6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,14 +25,14 @@ RUST_LOG=debug cargo run ### Testing ```bash -# Run all tests (requires BASE_PATH in .env) -cargo test +# Run all tests. DATABASE_URL is the only env var the suite needs; no .env required +DATABASE_URL=":memory:" cargo test # Run specific test -cargo test test_name +DATABASE_URL=":memory:" cargo test test_name # Run tests with output -cargo test -- --nocapture +DATABASE_URL=":memory:" cargo test -- --nocapture ``` ### Database Migrations @@ -664,7 +664,7 @@ Module map: ## Testing Patterns -Tests require `BASE_PATH` environment variable. Many integration tests create temporary directories and files. +Tests need `DATABASE_URL` set; `DATABASE_URL=":memory:"` is enough to run the whole suite without a `.env` (otherwise DB-backed tests such as `reels::tests::reel_capture_preserves_owner_defaults` panic with `DATABASE_URL must be set`). Many integration tests create temporary directories and files. When testing database code: - Use in-memory SQLite: `DATABASE_URL=":memory:"` diff --git a/README.md b/README.md index 62c3770..650d667 100644 --- a/README.md +++ b/README.md @@ -243,3 +243,10 @@ unset. populated retroactively) [default: `2000`]. Errors don't burn the cap; only successful hashes count. +## Testing +`DATABASE_URL` is the only environment variable the test suite needs, and an +in-memory SQLite database works, so no `.env` is required: + +```bash +DATABASE_URL=":memory:" cargo test +```