Skip to content

Commit aa6c979

Browse files
committed
cargo insta test cli: add --disable-nextest-doctest option
This adds an option to `cargo insta test` that prevents running doctests with `cargo test` when Nextest is the test runner, even if the given targets would ortherwise include doctests. I usually use `cargo insta test` with `--test-runner nextest --workspace` options. This always runs `cargo test --doctest` after nextest is done. This is an annoyance for me. I think the project I work on might have a doctest or two, but they are not very relevant, so I'm happy to rely on CI to catch any doctest errors. I only have a vague understanding of `cargo test` options, but I have not found an existing set of test specifiers that's equivalent to `--workspace --no-doctests-pretty-please`.
1 parent 181dfaf commit aa6c979

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cargo-insta/src/cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ struct TestCommand {
168168
/// Build for the target triple
169169
#[structopt(long)]
170170
target: Option<String>,
171+
/// Do not run `cargo test --doc` after `cargo nextest`, even if test specifiers would otherwise include doctests.
172+
#[structopt(long)]
173+
disable_nextest_doctest: bool,
171174
/// Follow up with review.
172175
#[structopt(long)]
173176
review: bool,
@@ -818,6 +821,9 @@ fn prepare_test_runner<'snapshot_ref>(
818821
None
819822
};
820823
let mut prevents_doc_run = false;
824+
if cmd.disable_nextest_doctest {
825+
prevents_doc_run = true;
826+
}
821827
if cmd.target_args.all || cmd.target_args.workspace {
822828
proc.arg("--all");
823829
}

0 commit comments

Comments
 (0)