Skip to content

Conversation

@max-sixty
Copy link
Collaborator

@max-sixty max-sixty commented Aug 30, 2025

Pass args to nextest and test binary with two -- — every after the first -- goes to nextest, and nextest passes everything after the second -- to the test binary.

For example, cargo insta test -- --status-level fail -- --nocapture

Currently it maintains backward compat -- a single -- will pass to the test binary only, with a depreciation warning. eventually that'll pass them to nextest only.

(for transparency, Claude Code helped with the code)

Pass `cargo insta test -- --status-level fail -- --nocapture`, with an additional `--` for args to nextest.

Currently it maintains backward compat -- a single `--` will pass to the test binary only, with a depreciation.

(for transparency, Claude Code helped with the code)
- Install cargo-nextest in Makefile if not present before running cargo-insta tests
- This ensures CI has nextest available for the new tests
- Tests will panic with helpful message if nextest is missing locally
- Add nextest installation to all test jobs that might run cargo-insta tests
- Uses taiki-e/install-action@nextest for efficient installation
- Ensures nextest is available for the new test suite
Changed footnote reference format from [1]: to [^1]: to match the reference [^1] used in the text.
@glehmann
Copy link

Thanks for working on this! I'm not sure the double -- would make the best user experience though.
Maybe it would be better to copy the relevant nextest options in cargo insta test? Or add a --test-runner-options?

@max-sixty
Copy link
Collaborator Author

Or add a --test-runner-options?

I considered this. but then would --test-runner-options="--status-level fail -- --nocapture" give the same result as cargo insta test -- --status-level fail -- --nocapture would in the proposed code?

(and then less keen on adding options to insta to track all of nextest's)

@glehmann
Copy link

Or add a --test-runner-options?

I considered this. but then would --test-runner-options="--status-level fail -- --nocapture" give the same result as cargo insta test -- --status-level fail -- --nocapture would in the proposed code?

I was thinking of cargo insta --test-runner nextest --test-runner-options="--status-level=fail" -- --no-capture, which continues to use -- as currently.

But both examples you're showing are good enough IMO. I would be more uncomfortable with cargo insta test -- -- --no-capture. That's a lot of --!

Anyway, that's probably a matter of taste. In the end, any solution would work for me 👍

Documents the new ability to pass arguments to both nextest and test binaries
using the additional separator pattern.
- Remove unnecessary argument splitting logic
- Pass all args as opaque list to nextest, let it handle its own separator
- Use decisive comments that describe what IS, not history
- Cleaner conditional logic without complex tuple destructuring
- Add test for backward compatibility with single separator
- Add test verifying args go to nextest with double separator
- Inline has_additional_separator check where it's used
- Tests now cover all argument routing scenarios
Resolved changelog conflict by keeping both entries:
- Our nextest argument passing feature
- The 1-based line numbering change from master
- Explain that backward compat works via nextest's test filter behavior
- Update changelog to note that only unrecognized args work as test filters
- Enhance deprecation warning to explain the mechanism
- Add detailed code comments about the argument routing strategy
- Clarify that nextest-specific flags would be consumed by nextest
@max-sixty
Copy link
Collaborator Author

on reflection, this code is overly complicated and would be much simpler if we didn't run doctests separately. so I got around to doing #803, and we can merge a version of this when we've removed the supplemental doctest run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants