@@ -4,14 +4,35 @@ purescript-spec-discovery is an extension to
44[ purescript-spec] ( https://github.com/purescript-spec/purescript-spec ) that finds
55specs automatically, given a regular expression pattern.
66
7- It only works for NodeJS environments, currently.
7+ It only works for NodeJS environments, currently, since it's using NodeJS
8+ facilities to list and load modules.
89
910## Usage
1011
12+ Install via Spago:
13+
1114``` bash
1215spago install spec-discovery
1316```
1417
18+ Use as main entry point:
19+
20+ ``` purescript
21+ module Test.Main where
22+
23+ import Prelude
24+ import Effect (Effect)
25+ import Test.Spec.Discovery (discoverAndRunSpec)
26+ import Test.Spec.Reporter.Console (consoleReporter)
27+
28+ main :: Effect Unit
29+ main = discoverAndRunSpecs [consoleReporter] """My\.Package\..*Spec"""
30+ ```
31+
32+ Or, if you need more sophistication, like an alternative config or whatnot, use
33+ the ` discover ` function to just return a list of specs and then run them in
34+ whatever way you need:
35+
1536``` purescript
1637module Test.Main where
1738
@@ -20,21 +41,23 @@ import Effect (Effect)
2041import Effect.Aff (launchAff_)
2142import Test.Spec.Discovery (discover)
2243import Test.Spec.Reporter.Console (consoleReporter)
23- import Test.Spec.Runner (runSpec)
44+ import Test.Spec.Runner.Node (runSpecAndExitProcess)
45+ import Test.Spec.Runner.Node.Config (defaultConfig)
2446
2547main :: Effect Unit
2648main = launchAff_ do
2749 specs <- discover """My\.Package\..*Spec"""
28- runSpec [consoleReporter] specs
50+ liftEffect $ runSpecAndExitProcess'
51+ { defaultConfig: defaultConfig { timeout = Nothing }
52+ , parseCLIOptions: true
53+ }
54+ [consoleReporter]
55+ specs
2956```
3057
3158All modules that match the regular expression, ** and have a definition
3259` spec :: Spec Unit ` ** , will be included and run.
3360
34- ## Documentation
35-
36- Documentation is publised on [ Pursuit] ( https://pursuit.purescript.org/packages/purescript-spec-discovery ) .
37-
3861## Contribute
3962
4063If you have any issues or possible improvements please file them as
0 commit comments