Skip to content

Unit testing: is it possible to override IsTerminal in a similar way to Interactive? #1869

@barrygiles

Description

@barrygiles

Is your feature request related to a problem? Please describe.
When unit testing functionality that checks Out.IsTerminal, there is no way to override this when using the TestConsole. This is possible with input by using Interactive().

The test in question relates to a pager utility, which should bypass paging if output is redirected. Otherwise, it should configure the pager according to variables.

Describe the solution you'd like
IsTerminal and Interactive feel like the same concept, with one related to output and one related to input. As it stands, I'm not sure how to override IsTerminal like I can with Interactive, which is preventing me from writing the tests I'd like.

I'm not sure what a solution should look like and would appreciate any suggestions if there is already a way to achieve this.


Please upvote 👍 this issue if you are interested in it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new featureneeds triageSomeone needs to take a look at this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions