Skip to content

Commit f3839f0

Browse files
committed
Update README
1 parent b23b920 commit f3839f0

2 files changed

Lines changed: 47 additions & 39 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: build
22

33
on:
44
push:

README.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
[![Build Status](https://travis-ci.org/hspec/hspec-example.png)](https://travis-ci.org/hspec/hspec-example)
1+
![Build Status](https://github.com/hspec/hspec-example/workflows/build/badge.svg)
22

33
# Running tests
44

5-
First make sure that all dependencies are installed:
5+
You can run your tests with `stack`, `cabal`, `ghci` or `sensei`. All of these
6+
options are discussed below.
67

7-
```
8-
$ cabal install --only-dependencies --enable-tests
9-
```
8+
**Note:** Using `stack` or `cabal` is slow. Use `ghci` or `sensei` for a
9+
faster edit-compile-test cycle.
1010

11-
## `cabal`
11+
## With `stack`
1212

13-
Just run
13+
Simply run:
1414

1515
```
16-
$ cabal test
16+
$ stack test
1717
```
1818

19-
and return code will indicate success or failure. However, you won't get nice
20-
test output.
19+
## With `cabal`
2120

22-
## `runhaskell`
23-
24-
If you want nice output you can use `runhaskell`:
21+
First make sure that you have a recent version of `cabal-install` (you need at
22+
least `v3.0.0.0`:
2523

2624
```
27-
$ runhaskell -isrc -itest test/Spec.hs
25+
$ cabal --numeric-version
26+
3.2.0.0
2827
```
2928

30-
Alternatively, you can build and run the test suite manually:
29+
Then simply run:
3130

3231
```
33-
$ cabal configure --enable-tests --disable-optimization && cabal build && ./dist/build/spec/spec
32+
$ cabal test --test-show-details=direct
3433
```
3534

36-
## `ghci`
35+
## With `ghci`
3736

38-
The fastest way to run your specs is with `ghci`. Make sure that `.ghci` is
37+
The fastest way to run your tests is with `ghci`. Make sure that `.ghci` is
3938
only writeable by you:
4039

4140
```
42-
$ chmod go-w .ghci
41+
$ chmod go-w . .ghci
4342
```
4443

45-
Then you can run the specs with:
44+
Then you can run your tests with:
4645

4746
```
48-
$ ghci test/Spec.hs
47+
$ cabal exec ghci test/Spec.hs
4948
*Main> :main
5049
```
5150

@@ -56,26 +55,35 @@ After modifying code use:
5655
*Main> :main
5756
```
5857

59-
(note that the `:reload` will be much faster than loading the code initially,
60-
this makes a big difference for larger projects)
58+
**Note:** `:reload` will be much faster than loading the code initially. This
59+
makes a big difference for larger projects.
6160

62-
## Cabal sandboxes
61+
## With `sensei`
6362

64-
To use `runhaskell` or `ghci` with Cabal sandboxes, run it with `cabal exec`:
63+
Using [hspec/sensei](https://github.com/hspec/sensei) is similar to using
64+
`ghci`, but it runs your tests automatically on file modifications. You don't
65+
have to invoke `:reload` and `:main` manually.
6566

66-
```
67-
$ cabal exec ghci test/Spec.hs
68-
*Main> :main
69-
```
70-
71-
```
72-
$ cabal exec -- runhaskell -isrc -itest test/Spec.hs
73-
```
67+
1. Install `sensei` with
68+
```
69+
$ stack install sensei
70+
```
71+
or
7472

75-
## Stack
73+
```
74+
$ cabal install sensei --installdir=$HOME/.local/bin
75+
```
7676

77-
To use `stack` to run your tests, you can simply run:
77+
1. Make sure that `.ghci` is only writeable by you:
78+
```
79+
$ chmod go-w . .ghci
80+
```
7881

79-
```
80-
$ stack setup && stack test
81-
```
82+
1. Run `sensei` with
83+
```
84+
$ stack exec sensei test/Spec.hs
85+
```
86+
or
87+
```
88+
$ cabal exec sensei test/Spec.hs
89+
```

0 commit comments

Comments
 (0)