-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add trivial entrypoint + update docs
- Loading branch information
Showing
4 changed files
with
59 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
module Test.Spec.Discovery (discover) where | ||
module Test.Spec.Discovery | ||
( discover | ||
, discoverAndRunSpecs | ||
) | ||
where | ||
|
||
import Prelude | ||
|
||
import Control.Promise (Promise) | ||
import Control.Promise as Promise | ||
import Data.Traversable (sequence_) | ||
import Effect (Effect) | ||
import Effect.Aff (launchAff_) | ||
import Effect.Aff.Class (class MonadAff, liftAff) | ||
import Effect.Class (liftEffect) | ||
import Test.Spec (Spec) | ||
import Test.Spec.Runner (Reporter) | ||
import Test.Spec.Runner.Node (runSpecAndExitProcess) | ||
|
||
foreign import getSpecs | ||
:: String | ||
-> Effect (Promise (Array (Spec Unit))) | ||
foreign import getSpecs :: String -> Effect (Promise (Array (Spec Unit))) | ||
|
||
discover | ||
:: forall m | ||
. MonadAff m | ||
=> String | ||
-> m (Spec Unit) | ||
discover :: ∀ m. MonadAff m => String -> m (Spec Unit) | ||
discover pattern = getSpecs pattern # Promise.toAffE >>= (pure <<< sequence_) # liftAff | ||
|
||
discoverAndRunSpecs :: Array Reporter -> String -> Effect Unit | ||
discoverAndRunSpecs reporters pattern = launchAff_ do | ||
specs <- discover pattern | ||
liftEffect $ runSpecAndExitProcess reporters specs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters