Skip to content

Add interactive tests for Windows CI #23

@lukidoescode

Description

@lukidoescode

Problem

The interactive tests for cargo changeset add are currently skipped on Windows CI due to a fundamental incompatibility between the console crate's TTY detection and GitHub Actions' ConPTY environment.

Root Cause

The console crate (used by dialoguer) uses GetConsoleMode() on Windows to detect if stdin/stdout is a terminal. In GitHub Actions CI, even when using expectrl's ConPTY-based pseudo-terminal, GetConsoleMode() fails and is_term() returns false.

This causes dialoguer's MultiSelect::interact_opt() to fail with:

error: IO error
caused by: not a terminal

Current Workaround

Interactive tests are conditionally compiled only on non-Windows platforms:

#[cfg(not(windows))]
mod interactive { ... }

Potential Solutions to Investigate

  1. Custom Term implementation: Create a wrapper around console::Term that overrides is_term() to always return true when a specific env var is set

  2. Alternative PTY library: Research if other Windows PTY libraries work better with GetConsoleMode()

  3. Dialoguer fork/PR: Contribute an option to dialoguer to skip the is_term() check when a force flag is provided

  4. Mock-based testing: Refactor crate selection to use a trait that can be mocked in tests, bypassing dialoguer entirely

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions