Skip to content

Instantly share code, notes, and snippets.

@NunoAlexandre
Created April 28, 2018 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NunoAlexandre/7f4a2cd24519f25d42ac3a38a9f4e527 to your computer and use it in GitHub Desktop.
Save NunoAlexandre/7f4a2cd24519f25d42ac3a38a9f4e527 to your computer and use it in GitHub Desktop.
### Command
``` bash
stack test --fast --test-arguments '-m "<identifier>"'
```
The `<identifier>` can be pretty much anything:
- Part of / a module's name
- A `describe` / `it` description
#### Example
Say you have the following `Spec`:
``` haskell
module MyApp.Foo.BarSpec (spec) where
spec :: Spec
spec = parallel $ do
describe "baz" $ do
it "qux"
```
- To run all the unit tests under `Foo`, run:
``` bash
stack test --fast --test-arguments '-m "Foo"'
```
- To run all the unit tests in the `BarSpec` module, run:
``` bash
stack test --fast --test-arguments '-m "Bar"'
```
Note it's just `Bar`, not `BarSpec`.
- To run the subset of unit tests under `baz`, run:
``` bash
stack test --fast --test-arguments '-m "baz"'
```
- To run a specific single unit test, run:
``` bash
stack test --fast --test-arguments '-m "qux"'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment