-
- Notifications
You must be signed in to change notification settings - Fork 121
Make it easier to compose a subset of nextest in code (as opposed to through CLI) #2622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #2622 +/- ## ========================================== - Coverage 78.40% 78.37% -0.03% ========================================== Files 107 107 Lines 24861 24969 +108 ========================================== + Hits 19492 19570 +78 - Misses 5369 5399 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I see the Not sure why the |
Ahh, unfortunately this isn't a correct approach, because the public API for cargo-nextest is defined as just the CLI. We do patch releases for nextest version upgrades based on that, and making functions from cargo-nextest public would necessitate a breaking version upgrade each time the APIs changed. I would be fine moving bits into nextest-runner as needed. The big new function is also not a good idea. I don't know why that needs to be a builder -- can the fields just be |
Ah, I see, I'll move these required pieces out of Regarding the |
Let me know if this update matches your expectations. A few notes: I started by trying to pull The next largest change was the need to introduce new error types for It can be hard to tell in the diff of moved code, so I'll add some comments where the |
Self::Version {} => { | ||
let mut cargo_cli = | ||
CargoCli::new("locate-project", manifest_path.as_deref(), output); | ||
CargoCli::new("locate-project", manifest_path.as_deref()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removal of OutputContext
, was passed into CargoCli::new
, where its only usage was in CargoCli::to_expression
to add the --color
argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the --color
argument passed in now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it isn't 😄
The way I went about this is noticing that the --color
argument seemed unnecessary, as all usages of to_expression
(the only place --color
was added) are in places that don't display their output - it is captured and only used internally (specifically in compute_binary_list
and acquire_graph_data
).
There is this comment in CargoCli
, which may or may not be relevant: // --color is handled by runner
.
I'm not entirely sure what it's intended to communicate, but I think it's explaining why there is no color
field on the CargoCli
struct. Maybe if we're no longer "internally" adding the --color
argument it should become a field of CargoCli
, so that users can set it? I'm not sure if CargoCli
is intended for use beyond what it is currently used for, though, in which case it could be superfluous.
My concern would be that I missed some way in which it was relevant. Presumably it was there for a reason, at least at one point, but I was unable to identify one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well -- when the user runs cargo nextest run
, we run cargo test --no-run
to build all the tests -- we want to forward the --color
argument to that underlying cargo test
execution. Totally fine with it being factored out to be easier to do, but we need to maintain this property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I went and had another look, and I misinterpreted things before.
I thought the output of cargo test --no-run
(in compute_binary_list
) was being captured, in the sense that it was only used for parsing to a list of binaries. But its output is also sent to stdout, so --color
is relevant.
My bad, I'll have to take a different approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks -- stdout (machine-readable output) is captured, but stderr (human-readable output) is passed through.
error!("{err}"); | ||
err.source() | ||
} | ||
display_target_triple_error_to_stderr(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original printing of TargetTripleError
to stderr.
Thanks, hoping to look at this soon (currently dealing with a hard deadline at my workplace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty reasonable! Just a few comments.
Self::Version {} => { | ||
let mut cargo_cli = | ||
CargoCli::new("locate-project", manifest_path.as_deref(), output); | ||
CargoCli::new("locate-project", manifest_path.as_deref()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the --color
argument passed in now?
Co-authored-by: Rain <rain@sunshowers.io>
See feature request for details: #2619