Skip to content

Commit

Permalink
[WIP] accept input characters for info queries, not just signals
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Dec 5, 2024
1 parent 1833ee8 commit 9a73de9
Show file tree
Hide file tree
Showing 11 changed files with 557 additions and 32 deletions.
111 changes: 111 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ config = { version = "0.14.1", default-features = false, features = [
chrono = "0.4.38"
clap = { version = "4.5.22", features = ["derive"] }
console-subscriber = "0.4.1"
crossterm = { version = "0.28.1", features = ["event-stream"] }
dialoguer = "0.11.0"
debug-ignore = "1.0.5"
duct = "0.13.7"
Expand Down
31 changes: 25 additions & 6 deletions cargo-nextest/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use nextest_runner::{
},
double_spawn::DoubleSpawnInfo,
errors::WriteTestListError,
input::InputHandlerKind,
list::{
BinaryList, OutputFormat, RustTestArtifact, SerializableFormat, TestExecuteContext,
TestList,
Expand Down Expand Up @@ -986,6 +987,13 @@ struct TestReporterOpts {
#[arg(long, env = "NEXTEST_HIDE_PROGRESS_BAR", value_parser = BoolishValueParser::new())]
hide_progress_bar: bool,

/// Disable handling of input keys from the terminal.
///
/// By default, when running a terminal, nextest accepts the `t` key to dump
/// test information. This flag disables that behavior.
#[arg(long, env = "NEXTEST_NO_INPUT_HANDLER", value_parser = BoolishValueParser::new())]
no_input_handler: bool,

Check warning on line 995 in cargo-nextest/src/dispatch.rs

View check run for this annotation

Codecov / codecov/patch

cargo-nextest/src/dispatch.rs#L995

Added line #L995 was not covered by tests

/// Format to use for test results (experimental).
#[arg(
long,
Expand Down Expand Up @@ -1780,12 +1788,16 @@ impl App {
.color
.should_colorize(supports_color::Stream::Stderr);

let mut reporter = reporter_opts
.to_builder(no_capture, should_colorize)
.set_verbose(self.base.output.verbose)
.build(&test_list, &profile, output, structured_reporter);
let signal_handler = SignalHandlerKind::Standard;
let input_handler = if reporter_opts.no_input_handler {
InputHandlerKind::Noop

Check warning on line 1793 in cargo-nextest/src/dispatch.rs

View check run for this annotation

Codecov / codecov/patch

cargo-nextest/src/dispatch.rs#L1793

Added line #L1793 was not covered by tests
} else {
// This means that the input handler determines whether it should be
// enabled.
InputHandlerKind::Standard
};

let handler = SignalHandlerKind::Standard;
// Make the runner.
let runner_builder = match runner_opts.to_builder(cap_strat) {
Some(runner_builder) => runner_builder,
None => {
Expand All @@ -1798,11 +1810,18 @@ impl App {
&test_list,
&profile,
cli_args,
handler,
signal_handler,
input_handler,
double_spawn.clone(),
target_runner.clone(),
)?;

// Make the reporter.
let mut reporter = reporter_opts
.to_builder(no_capture, should_colorize)
.set_verbose(self.base.output.verbose)
.build(&test_list, &profile, output, structured_reporter);

configure_handle_inheritance(no_capture)?;
let run_stats = runner.try_execute(|event| {
// Write and flush the event.
Expand Down
2 changes: 2 additions & 0 deletions nextest-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cargo_metadata.workspace = true
config.workspace = true
cfg-if.workspace = true
chrono.workspace = true
crossterm.workspace = true
debug-ignore.workspace = true
duct.workspace = true
future-queue.workspace = true
Expand Down Expand Up @@ -69,6 +70,7 @@ thiserror.workspace = true
# For parsing of .cargo/config.toml files
tokio = { workspace = true, features = [
"fs",
"io-std",
"io-util",
"macros",
"process",
Expand Down
Loading

0 comments on commit 9a73de9

Please sign in to comment.