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