Skip to content

Commit 33994a5

Browse files
committed
License and readme
1 parent 1e36ecd commit 33994a5

File tree

3 files changed

+38
-7
lines changed

3 files changed

+38
-7
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Oskar Wickstrom
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[![build](https://github.com/purescript-spec/purescript-spec-node/actions/workflows/build.yml/badge.svg)](https://github.com/purescript-spec/purescript-spec-node/actions/workflows/build.yml)
2+
3+
# PureScript Spec test runner for Node
4+
5+
The default runner for your tests if you're running on Node.
6+
7+
Documentation and examples here: https://purescript-spec.github.io/purescript-spec/running/

src/Node/Config.purs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import Data.Tuple (fst)
3131
import Data.Tuple.Nested ((/\))
3232
import Effect.Aff.Class (class MonadAff, liftAff)
3333
import Effect.Class (class MonadEffect, liftEffect)
34-
import Options.Applicative ((<**>))
3534
import Options.Applicative as Opt
3635
import Partial (crashWith)
3736
import Partial.Unsafe (unsafePartial)
@@ -58,8 +57,11 @@ fromCommandLine = fromCommandLine' defaultConfig commandLineOptionParsers
5857

5958
fromCommandLine' :: m a. MonadEffect m => a -> Array (OptionParser a) -> m a
6059
fromCommandLine' defaultCfg options =
61-
liftEffect (Opt.execParser $ optionParser options) <#>
60+
liftEffect (Opt.customExecParser prefs $ optionParser options) <#>
6261
\f -> f defaultCfg
62+
where
63+
prefs = Opt.defaultPrefs # \(Opt.ParserPrefs p) ->
64+
Opt.ParserPrefs p { prefShowHelpOnError = true }
6365

6466
defaultConfig :: TestRunConfig
6567
defaultConfig =
@@ -157,6 +159,7 @@ timeout :: ∀ r. OptionParser { timeout :: Maybe Milliseconds | r }
157159
timeout = ado
158160
seconds <- optional $ Opt.option Opt.int $ fold
159161
[ Opt.long "timeout"
162+
, Opt.metavar "SECONDS"
160163
, Opt.help "timeout for each individual test case, in seconds."
161164
]
162165

@@ -178,8 +181,8 @@ filterByName = ado
178181
pat <- optional $ Opt.strOption $ fold
179182
[ Opt.long "example"
180183
, Opt.short 'e'
181-
, Opt.metavar "PATTERN"
182-
, Opt.help "filter test cases by full name. Matching is case-sensitive."
184+
, Opt.metavar "TEXT"
185+
, Opt.help "run only tests whose full names contain the given text. Matching is case-sensitive."
183186
]
184187

185188
let f = pat <#> \s -> Str.toLower >>> Str.contains (Str.Pattern $ Str.toLower s)
@@ -193,7 +196,7 @@ filterByRegex = ado
193196
, Opt.short 'E'
194197
, Opt.metavar "REGEX"
195198
, Opt.help """
196-
filter test cases by regular expression.
199+
run only tests whose full names match the given regex.
197200
This will unapologetically crash if the provided regex doesn't compile.
198201
The regex is case-insensitive.
199202
"""
@@ -208,8 +211,8 @@ filterByRegex = ado
208211

209212
optionParser :: a. Array (OptionParser a) -> Opt.ParserInfo (a -> a)
210213
optionParser options =
211-
Opt.info (combined <**> Opt.helper) $
214+
Opt.info (Opt.helper <*> combined) $
212215
Opt.fullDesc
213-
<> Opt.header "CollegeVine’s very own PureScript test runner."
216+
<> Opt.header "PureScript Spec test runner for Node"
214217
where
215218
combined = foldl combineOptionParsers emptyOptionParser options

0 commit comments

Comments
 (0)