0 | module Evince.Async.Runner
 1 |
 2 | import IO.Async
 3 | import IO.Async.Loop.Sync
 4 | import Evince.Core
 5 | import Evince.Async.Hoist
 6 | import Evince.Async.Shared
 7 |
 8 | -- Entry points for the synchronous `SyncST` event loop (run via `syncApp`),
 9 | -- which works on the Chez/Racket/RefC backends. The loop-agnostic
10 | -- orchestration lives in `Evince.Async.Shared`; these entry points just supply
11 | -- the `syncApp` loop runner.
12 |
13 | ||| Run a spec under the async driver with custom configuration, printing
14 | ||| results and exiting non-zero if any test failed. Concurrency is controlled
15 | ||| by `cfg.jobs` (`--jobs`).
16 | export
17 | runSpecAsyncWith : RunConfig -> Spec (Async SyncST []) () () -> IO ()
18 | runSpecAsyncWith = runSpecVia syncApp
19 |
20 | ||| Run a spec under the async driver with default configuration.
21 | export
22 | runSpecAsync : Spec (Async SyncST []) () () -> IO ()
23 | runSpecAsync = runSpecAsyncWith defaultConfig
24 |
25 | ||| Run under the async driver with custom configuration and return the
26 | ||| summary without exiting. Useful for meta-testing.
27 | export
28 | runSpecAsyncWithSummaryAndConfig : RunConfig -> Spec (Async SyncST []) () () -> IO Summary
29 | runSpecAsyncWithSummaryAndConfig = summaryVia syncApp
30 |
31 | ||| Run under the async driver and return the summary without exiting.
32 | export
33 | runSpecAsyncWithSummary : Spec (Async SyncST []) () () -> IO Summary
34 | runSpecAsyncWithSummary = runSpecAsyncWithSummaryAndConfig defaultConfig
35 |
36 | ||| Run a spec under the async driver, reading CLI args (e.g. `--jobs=N`).
37 | export
38 | runSpecAsyncWithArgs : Spec (Async SyncST []) () () -> IO ()
39 | runSpecAsyncWithArgs = runSpecArgsVia syncApp
40 |
41 | ||| Run under the async driver with fail-fast - stop after the first failure.
42 | export
43 | runSpecAsyncFailFast : Spec (Async SyncST []) () () -> IO ()
44 | runSpecAsyncFailFast = runSpecFailFastVia syncApp
45 |
46 | ||| Run under the async driver with per-test timing displayed.
47 | export
48 | runSpecAsyncTimed : Spec (Async SyncST []) () () -> IO ()
49 | runSpecAsyncTimed = runSpecTimedVia syncApp
50 |
51 | ||| Run a concrete `Spec IO` under the async driver, hoisting its actions into
52 | ||| `Async` via `liftIO`. Group hooks (`beforeAll`/`beforeAllWith`) keep their
53 | ||| `IO`-baked (no-op) synchronization, so prefer an effect-polymorphic spec
54 | ||| with `runSpecAsync` if you run group-level setup concurrently.
55 | export
56 | runSpecAsyncIO : Spec IO () () -> IO ()
57 | runSpecAsyncIO = runSpecAsync . hoistSpec liftIO
58 |
59 | ||| Like `runSpecAsyncIO`, with custom configuration.
60 | export
61 | runSpecAsyncIOWith : RunConfig -> Spec IO () () -> IO ()
62 | runSpecAsyncIOWith cfg = runSpecAsyncWith cfg . hoistSpec liftIO
63 |