Skip to content

Commit 111b685

Browse files
authored
Use tasty-rerun to allow rerunning failed tests only (#484)
Use by stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
1 parent c74e9b5 commit 111b685

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist-newstyle/
44
cabal.project.local
55
*~
66
*.lock
7+
/.tasty-rerun-log

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ To build and work on `ghcide` itself, you can use Stack or cabal, e.g.,
254254
running `stack test` will execute the test suite.
255255
If you are using Windows, you should disable the `auto.crlf` setting and configure your editor to use LF line endings, directly or making it use the existing `.editor-config`.
256256

257+
If you are chasing down test failures, you can use the tasty-rerun feature by running tests as
258+
259+
stack --stack-yaml=stack84.yaml test --test-arguments "--rerun"
260+
261+
This writes a log file called `.tasty-rerun-log` of the failures, and only runs those.
262+
See the [tasty-rerun](https://hackage.haskell.org/package/tasty-rerun-1.1.17/docs/Test-Tasty-Ingredients-Rerun.html) documentation for other options.
263+
257264
### Building the extension
258265

259266
For development, you can also the VSCode extension from this repository (see

ghcide.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ test-suite ghcide-tests
255255
tasty-expected-failure,
256256
tasty-hunit,
257257
tasty-quickcheck,
258+
tasty-rerun,
258259
text
259260
hs-source-dirs: test/cabal test/exe test/src
260261
include-dirs: include

stack.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ extra-deps:
1313
- shake-0.18.5
1414
- parser-combinators-1.2.1
1515
- haddock-library-1.8.0
16+
- tasty-rerun-1.1.17
1617
nix:
1718
packages: [zlib]

stack84.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@ extra-deps:
2222
- unordered-containers-0.2.10.0
2323
- file-embed-0.0.11.2
2424
- heaps-0.3.6.1
25+
26+
# For tasty-retun
27+
- ansi-terminal-0.10.3
28+
- ansi-wl-pprint-0.6.9
29+
- tasty-1.2.3
30+
- tasty-rerun-1.1.17
2531
nix:
2632
packages: [zlib]

test/exe/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ import Test.QuickCheck
3939
import Test.QuickCheck.Instances ()
4040
import Test.Tasty
4141
import Test.Tasty.ExpectedFailure
42+
import Test.Tasty.Ingredients.Rerun
4243
import Test.Tasty.HUnit
4344
import Test.Tasty.QuickCheck
4445
import Data.Maybe
4546

4647
main :: IO ()
47-
main = defaultMain $ testGroup "HIE"
48+
main = defaultMainWithRerun $ testGroup "HIE"
4849
[ testSession "open close" $ do
4950
doc <- openDoc' "Testing.hs" "haskell" ""
5051
void (skipManyTill anyMessage message :: Session WorkDoneProgressCreateRequest)

0 commit comments

Comments
 (0)