Skip to content

Be able to allocate a TTY when running tests #5897

@thomasjm

Description

@thomasjm

I'm the author of the Sandwich test framework. One of Sandwich's key features is the ability to present a TUI interface for your tests. I think TUI-based testing is really useful, because it gives you a nice interface to watch and inspect the way your tests run.

The problem is, the default stack test behavior doesn't support this, because it doesn't allocate a TTY for the tests. I have a couple demos to demonstrate this:

git clone [email protected]:codedownio/sandwich.git

Normal operation: demo-basic is an executable

This is the workaround we've used until now--rather than using a test-suite, we just make the tests an executable and run them with stack run.

However, this has the downside that Stack builds all executables by default, so now library users have to build the tests even when they aren't planning on running them.

stack run demo-basic -- --tui

stack test operation: demo-stack-test is a test-suite

If you try to run a test-suite with the TUI, it errors out:

stack test demo-stack-test --test-arguments --tui
demo-stack-test> test (suite: demo-stack-test, args: --tui)

Some formatters failed: '[getTerminalAttributes: illegal operation (Inappropriate ioctl for device)]'
0 runs succeeded out of 1 repeat (3 tests)

Feature request

Thus, this is a feature request to modify how stack test works so it can use a TUI, similar to stack run. I'm not sure this should happen all the time, maybe it should be controlled by a flag?

I could take a stab at implementing this if I could get some guidance from a Stack dev.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions