Lightpanda: the headless browser designed for AI and automation
test: run filtered tests in one process by default
Adrià Arrufat047ed3ed88da
diff --git a/AGENTS.md b/AGENTS.mdindex fb0007a95..0ae2d4aab 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -15,7 +15,7 @@ TEST_FILTER="WebApi: #selector_all" make test # Filter main + subtest (separatTEST_VERBOSE=true make testTEST_FAIL_FIRST=true make testMETRICS=true make test # Capture allocation/duration metrics as JSON-TEST_JOBS=1 make test # Run in one process (default: up to 4 in parallel)+TEST_JOBS=1 make test # Run in one process (default: up to 4, or 1 when filtered)```The custom test runner (`src/test_runner.zig`) detects memory leaks in debug builds. **A test that allocates without freeing fails** — not just lints.diff --git a/README.md b/README.mdindex 52c6fd076..80d0ff3d7 100644--- a/README.md+++ b/README.md@@ -350,7 +350,7 @@ TEST_FILTER="WebApi: #selector_all" make test # Filter main + subtest (separatTEST_VERBOSE=true make testTEST_FAIL_FIRST=true make testMETRICS=true make test # Capture allocation/duration metrics as JSON-TEST_JOBS=1 make test # Run in one process (default: up to 4 in parallel)+TEST_JOBS=1 make test # Run in one process (default: up to 4, or 1 when filtered)```### End to end testsdiff --git a/src/test_runner.zig b/src/test_runner.zigindex af269c05b..a54bb6940 100644--- a/src/test_runner.zig+++ b/src/test_runner.zig@@ -568,13 +568,18 @@ const Env = struct {.verbose = readEnvBool(map, "TEST_VERBOSE", false),.fail_first = readEnvBool(map, "TEST_FAIL_FIRST", false),// metrics are compared across runs, so keep them to one process- .jobs = if (metrics) 1 else readEnvInt(map, "TEST_JOBS") orelse defaultJobs(),+ .jobs = if (metrics) 1 else readEnvInt(map, "TEST_JOBS") orelse defaultJobs(filter, subfilter),.claim = readEnv(map, "TEST_CLAIM"),.report = readEnv(map, "TEST_REPORT"),};}- fn defaultJobs() usize {+ /// A filtered run is usually someone debugging one case, who wants as+ /// little variability as possible, so it stays in one process unless asked.+ fn defaultJobs(filter: ?[]const u8, subfilter: ?[]const u8) usize {+ if (filter != null or subfilter != null) {+ return 1;+ }const cpus = std.Thread.getCpuCount() catch 1;return @min(cpus, 4);}