-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from codewars/hspec-formatters-codewars-0.3.0
- Loading branch information
Showing
2 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
module Main where | ||
|
||
import Test.Hspec.Runner | ||
import Test.Hspec.Formatters.Codewars (codewars) | ||
module Main (main) where | ||
|
||
import qualified Spec | ||
import System.Exit | ||
import Test.Hspec.Core.Formatters.V2 (formatException, formatterToFormat) | ||
import Test.Hspec.Core.Util (safeTry) | ||
import Test.Hspec.Formatters.Codewars (escapeLF, newFormatter) | ||
import Test.Hspec.Runner | ||
|
||
main :: IO () | ||
main = hspecWith defaultConfig {configFormatter = Just codewars} Spec.spec | ||
main = do | ||
codewars <- newFormatter | ||
summary <- safeTry $ runSpec Spec.spec defaultConfig {configFormat = Just $ formatterToFormat codewars} | ||
case summary of | ||
Left ex -> do | ||
putStrLn $ "\n<ERROR::>Test suite crashed<:LF:>" ++ (escapeLF $ formatException ex) | ||
exitFailure | ||
Right s -> evaluateSummary s |