sbt/sbt-app/src
PandaMan 20ce3abe5f
[2.x] fix: Fixes testing EventHandler race condition
**Problem**
ScalaTest's `AsyncFunSuite` invokes the test framework's event handler **asynchronously**. sbt's `TestFramework` was collecting events in a **`ListBuffer`**, which is not thread-safe. With multiple suites (e.g. `IgnoreBugTestA` and `IgnoreBugTestB`), concurrent `handle()` calls could corrupt the buffer, so events from the second suite were lost or merged incorrectly and the summary showed wrong suite/test counts.

**Solution**
Replaced the event buffer in `sbt.TestFramework`'s `EventHandler` with a **thread-safe** collection: **`CopyOnWriteArrayList`** (from `java.util.concurrent`). Event handling now uses:
- `CopyOnWriteArrayList[Event]` for `results`
- `results.add(e)` in the handler
- `results.asScala.toList` when building `TestEvent` / `SuiteResult` (via `scala.jdk.CollectionConverters._`)

This preserves ordering and ensures all suites' events are reported correctly when using async styles like `AsyncFunSuite` with `test`/`ignore`.
2026-02-09 10:55:06 -05:00
..
main refactor: Hide Ivy-related classes 2025-08-09 01:52:45 -04:00
repo-override-test lm-coursier-shaded 2.0.12 2022-10-30 18:25:04 -04:00
sbt-test [2.x] fix: Fixes testing EventHandler race condition 2026-02-09 10:55:06 -05:00
test/scala/sbt Fix #8441: Allow system JNA on OpenBSD by making jna.nosys conditional 2026-01-08 15:19:36 -08:00