I'm cloning the following repository and making one change to the stack.yaml
by adding at the end:
docker:
enable: true
To run all the tests for haskoin-core
I'm using
stack test haskoin-core:test-haskoin-core
What I want to do is run just one test. If this were HSpec
(which it is not) I'd be running something like:
stack test --test-arguments -m "Network.Haskoin.Network.Units"
Now what I could do is modify the file haskcoin-core/test/Main.hs
and comment out all the tests I don't want to run. But ya know - there should be a simpler way to run it with just command line parameters. (Mutating the file system goes agains the whole functional grain of Haskell).
I'd also be open to running it with stack ghci
somehow.
My question is: How to run an individual test with Stack and Haskell Test.Framework?
As of mid 2019, I think stack
has changed.
See --help
for options:
stack test --test-arguments "--help"
Do a --dry-run
to see what tests will run:
stack test --test-arguments "--dry-run"
Select tests with --match
. Note, this alleges glob patterns will work but they don't seem to for me:
stack test --test-arguments "--match=foobar"
AFAICT, "foobar"
is interpreted like a glob of *foobar*
, but I can't be explicit about it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With