@@ -31,7 +31,6 @@ import Data.Tuple (fst)
31
31
import Data.Tuple.Nested ((/\))
32
32
import Effect.Aff.Class (class MonadAff , liftAff )
33
33
import Effect.Class (class MonadEffect , liftEffect )
34
- import Options.Applicative ((<**>))
35
34
import Options.Applicative as Opt
36
35
import Partial (crashWith )
37
36
import Partial.Unsafe (unsafePartial )
@@ -58,8 +57,11 @@ fromCommandLine = fromCommandLine' defaultConfig commandLineOptionParsers
58
57
59
58
fromCommandLine' :: ∀ m a . MonadEffect m => a -> Array (OptionParser a ) -> m a
60
59
fromCommandLine' defaultCfg options =
61
- liftEffect (Opt .execParser $ optionParser options) <#>
60
+ liftEffect (Opt .customExecParser prefs $ optionParser options) <#>
62
61
\f -> f defaultCfg
62
+ where
63
+ prefs = Opt .defaultPrefs # \(Opt.ParserPrefs p) ->
64
+ Opt.ParserPrefs p { prefShowHelpOnError = true }
63
65
64
66
defaultConfig :: TestRunConfig
65
67
defaultConfig =
@@ -157,6 +159,7 @@ timeout :: ∀ r. OptionParser { timeout :: Maybe Milliseconds | r }
157
159
timeout = ado
158
160
seconds <- optional $ Opt .option Opt .int $ fold
159
161
[ Opt .long " timeout"
162
+ , Opt .metavar " SECONDS"
160
163
, Opt .help " timeout for each individual test case, in seconds."
161
164
]
162
165
@@ -178,8 +181,8 @@ filterByName = ado
178
181
pat <- optional $ Opt .strOption $ fold
179
182
[ Opt .long " example"
180
183
, 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."
183
186
]
184
187
185
188
let f = pat <#> \s -> Str .toLower >>> Str .contains (Str.Pattern $ Str .toLower s)
@@ -193,7 +196,7 @@ filterByRegex = ado
193
196
, Opt .short ' E'
194
197
, Opt .metavar " REGEX"
195
198
, Opt .help """
196
- filter test cases by regular expression .
199
+ run only tests whose full names match the given regex .
197
200
This will unapologetically crash if the provided regex doesn't compile.
198
201
The regex is case-insensitive.
199
202
"""
@@ -208,8 +211,8 @@ filterByRegex = ado
208
211
209
212
optionParser :: ∀ a . Array (OptionParser a ) -> Opt.ParserInfo (a -> a )
210
213
optionParser options =
211
- Opt .info (combined <**> Opt .helper ) $
214
+ Opt .info (Opt .helper <*> combined ) $
212
215
Opt .fullDesc
213
- <> Opt .header " CollegeVine’s very own PureScript test runner. "
216
+ <> Opt .header " PureScript Spec test runner for Node "
214
217
where
215
218
combined = foldl combineOptionParsers emptyOptionParser options
0 commit comments