Select which test to run with Hspec and stack

2020-06-03 03:02发布

问题:

I've written a series of test, using the automatic spec discovery feature of Hspec. I'm also using stack as my build tool.

My test directory has the the Spec.hs file, along with the test files for the different modules of my application (e.g. Module0Spec.hs, Module1Spec.hs).

Now, when I start writing a new test module, or when I want to re-run a failed test after code changes, I'd like to be able to run only a given test module.

Is there any way in which either stack or Hspec allow to do this?

回答1:

I found the answer here. I was trying with --, however I needed to use --test-arguments:

stack test --test-arguments "-m "Module0""