0 | module Evince.Async.JS
 1 |
 2 | import public Evince.Async.Synchronized
 3 | import public Evince.Async.Hoist
 4 | import public Evince.Async.Shared
 5 |
 6 | import IO.Async
 7 | import IO.Async.JS
 8 | import Evince.Core
 9 |
10 | -- JS/Node entry points: idris2-async's `JS` event loop, run via `app`. These
11 | -- mirror `Evince.Async.Runner`'s names exactly (no `JS` suffix), so a
12 | -- polymorphic spec runs unchanged on either backend - only the import and the
13 | -- package dependency differ.
14 |
15 | ||| Run a spec under the async driver with custom configuration, printing
16 | ||| results and exiting non-zero if any test failed. Concurrency is controlled
17 | ||| by `cfg.jobs` (`--jobs`).
18 | export
19 | runSpecAsyncWith : RunConfig -> Spec (Async JS []) () () -> IO ()
20 | runSpecAsyncWith = runSpecVia app
21 |
22 | ||| Run a spec under the async driver with default configuration.
23 | export
24 | runSpecAsync : Spec (Async JS []) () () -> IO ()
25 | runSpecAsync = runSpecAsyncWith defaultConfig
26 |
27 | ||| Run under the async driver with custom configuration and return the
28 | ||| summary without exiting. Useful for meta-testing.
29 | export
30 | runSpecAsyncWithSummaryAndConfig : RunConfig -> Spec (Async JS []) () () -> IO Summary
31 | runSpecAsyncWithSummaryAndConfig = summaryVia app
32 |
33 | ||| Run under the async driver and return the summary without exiting.
34 | export
35 | runSpecAsyncWithSummary : Spec (Async JS []) () () -> IO Summary
36 | runSpecAsyncWithSummary = runSpecAsyncWithSummaryAndConfig defaultConfig
37 |
38 | ||| Run a spec under the async driver, reading CLI args (e.g. `--jobs=N`).
39 | export
40 | runSpecAsyncWithArgs : Spec (Async JS []) () () -> IO ()
41 | runSpecAsyncWithArgs = runSpecArgsVia app
42 |
43 | ||| Run under the async driver with fail-fast - stop after the first failure.
44 | export
45 | runSpecAsyncFailFast : Spec (Async JS []) () () -> IO ()
46 | runSpecAsyncFailFast = runSpecFailFastVia app
47 |
48 | ||| Run under the async driver with per-test timing displayed.
49 | export
50 | runSpecAsyncTimed : Spec (Async JS []) () () -> IO ()
51 | runSpecAsyncTimed = runSpecTimedVia app
52 |
53 | ||| Run a concrete `Spec IO` under the async driver, hoisting its actions into
54 | ||| `Async` via `liftIO`. Group hooks keep their `IO`-baked (no-op)
55 | ||| synchronization, so prefer an effect-polymorphic spec with `runSpecAsync`
56 | ||| if you run group-level setup concurrently.
57 | export
58 | runSpecAsyncIO : Spec IO () () -> IO ()
59 | runSpecAsyncIO = runSpecAsync . hoistSpec liftIO
60 |
61 | ||| Like `runSpecAsyncIO`, with custom configuration.
62 | export
63 | runSpecAsyncIOWith : RunConfig -> Spec IO () () -> IO ()
64 | runSpecAsyncIOWith cfg = runSpecAsyncWith cfg . hoistSpec liftIO
65 |