Skip to content

Commit 94b7a3e

Browse files
committed
Rerun test suite to avoid flaky tests
1 parent 01f8fd8 commit 94b7a3e

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ jobs:
6464
# run the tests without parallelism, otherwise tasty will attempt to run
6565
# all functional test cases simultaneously which causes way too many hls
6666
# instances to be spun up for the poor github actions runner to handle
67-
run: cabal test --test-options=-j1
67+
run: cabal test --test-options="-j1 --rerun-update" || cabal test --test-options="-j1 --rerun" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test --test-options="-j1 --rerun"
6868

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ cabal.project.local
66
*~
77
*.lock
88

9+
.tasty-rerun-log
10+
911
# shake build information
1012
_build/
1113

haskell-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ test-suite wrapper-test
276276
, process
277277
, tasty
278278
, tasty-ant-xml >=1.1.6
279+
, tasty-rerun
279280

280281
hs-source-dirs: test/wrapper
281282
main-is: Main.hs

test/wrapper/Main.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ import Data.Maybe
44
import Test.Hls.Util
55
import Test.Tasty
66
import Test.Tasty.HUnit
7+
import Test.Tasty.Ingredients.Rerun
8+
import Test.Tasty.Runners ( listingTests, consoleTestReporter)
79
import System.Process
810
import System.Environment
911

1012
main :: IO ()
1113
main = do
1214
flushStackEnvironment
13-
defaultMain $
14-
testGroup "haskell-language-server-wrapper" [projectGhcVersionTests]
15+
defaultMainWithIngredients
16+
[rerunningTests [listingTests, consoleTestReporter]] $
17+
testGroup "haskell-language-server-wrapper" [projectGhcVersionTests]
1518

1619
projectGhcVersionTests :: TestTree
1720
projectGhcVersionTests = testGroup "--project-ghc-version"

0 commit comments

Comments
 (0)