sandwich
sandwich copied to clipboard
Cannot use TUI from stack test
Into a brand new stack project, I changed test/Spec.hs into the following file:
module Main where
import Test.Sandwich
basic :: TopSpec
basic = do
describe "Test TUI" $ do
it "displays" $ do
True `shouldBe` True
main :: IO ()
main = runSandwichWithCommandLineArgs defaultOptions basic
Running stack test works as expected, but not with the TUI:
$ stack test --test-arguments --tui
foo> test (suite: foo-test, args: --tui)
Some formatters failed: '[getTerminalAttributes: illegal operation (Inappropriate ioctl for device)]'
1 runs succeeded out of 1 repeats
foo> Test suite foo-test passed
Yes, this is a problem. This is why all the examples use "executables" rather than "tests" in their cabal file.
I was thinking about submitting a PR to Stack to provide a tty when doing stack test, when possible. I don't think it would make sense to do all the time since stack test is also used in non-interactive scenarios. But it would be nice to be able to use the normal "tests" target.
This works out of the box now with Stack 2.9.3!