https://github.com/purescript-spec/purescript-spec-discovery
A purescript-spec extension that finds your specs automatically!
https://github.com/purescript-spec/purescript-spec-discovery
Last synced: 4 months ago
JSON representation
A purescript-spec extension that finds your specs automatically!
- Host: GitHub
- URL: https://github.com/purescript-spec/purescript-spec-discovery
- Owner: purescript-spec
- License: mpl-2.0
- Created: 2016-10-25T19:54:09.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-07-22T14:17:27.000Z (9 months ago)
- Last Synced: 2025-08-10T04:43:41.612Z (9 months ago)
- Language: PureScript
- Size: 146 KB
- Stars: 22
- Watchers: 2
- Forks: 22
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-spec-discovery
purescript-spec-discovery is an extension to
[purescript-spec](https://github.com/purescript-spec/purescript-spec) that finds
specs automatically, given a regular expression pattern.
It only works for NodeJS environments, currently, since it's using NodeJS
facilities to list and load modules.
## Usage
Install via Spago:
```bash
spago install spec-discovery
```
Use as main entry point:
```purescript
module Test.Main where
import Prelude
import Effect (Effect)
import Test.Spec.Discovery (discoverAndRunSpecs)
import Test.Spec.Reporter.Console (consoleReporter)
main :: Effect Unit
main = discoverAndRunSpecs [consoleReporter] """My\.Package\..*Spec"""
```
Or, if you need more sophistication, like an alternative config or whatnot, use
the `discover` function to just return a list of specs and then run them in
whatever way you need:
```purescript
module Test.Main where
import Prelude
import Effect (Effect)
import Effect.Aff (launchAff_)
import Test.Spec.Discovery (discover)
import Test.Spec.Reporter.Console (consoleReporter)
import Test.Spec.Runner.Node (runSpecAndExitProcess)
import Test.Spec.Runner.Node.Config (defaultConfig)
main :: Effect Unit
main = launchAff_ do
specs <- discover """My\.Package\..*Spec"""
liftEffect $ runSpecAndExitProcess'
{ defaultConfig: defaultConfig { timeout = Nothing }
, parseCLIOptions: true
}
[consoleReporter]
specs
```
All modules that match the regular expression, **and have a definition
`spec :: Spec Unit`**, will be included and run.
## Contribute
If you have any issues or possible improvements please file them as
[GitHub Issues](https://github.com/purescript-spec/purescript-spec-discovery/issues).
Pull requests requests are encouraged.
## License
[Mozilla Public License Version 2.0](LICENSE).