Skip to content
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

Cannot set cargoExtraArgs in craneLib.cargoNextest (#675) #678

Merged
merged 8 commits into from
Aug 6, 2024
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
* Fixed vendoring dependencies from an alternative registry which they
themselves have dependencies on crates from _other_ registries.
* Fixed `cargoNextest`'s positioning of `cargoExtraArgs` to form a valid command
invocation when specified.

## [0.18.0] - 2024-07-05

Expand Down
1 change: 1 addition & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ Except where noted below, all derivation attributes are delegated to
* `cargoNextestExtraArgs`: additional flags to be passed in the nextest invocation
(e.g. specifying a profile)
- Default value: `""`
- Note that all flags from `cargo test` are supported.
* `partitions`: The number of separate nextest partitions to run. Useful if the
test suite takes a long time and can be parallelized across multiple build
nodes.
Expand Down
11 changes: 6 additions & 5 deletions lib/cargoNextest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let
"withLlvmCov"
];

mkUpdatedArgs = { cmd ? lib.optionalString (!withLlvmCov) "run", extraSuffix ? "", moreArgs ? "", withLlvmCov }: args // {
mkUpdatedArgs = { cmd ? "run", extraSuffix ? "", moreArgs ? "", withLlvmCov }: args // {
inherit cargoArtifacts;
pnameSuffix = "-nextest${extraSuffix}";
doCheck = args.doCheck or true;
Expand All @@ -44,10 +44,11 @@ let
'';

checkPhaseCargoCommand = ''
cargo ${cargoExtraArgs} \
${lib.optionalString withLlvmCov "llvm-cov ${cargoLlvmCovExtraArgs}"} \
nextest ${cmd} ''${CARGO_PROFILE:+--cargo-profile $CARGO_PROFILE} \
${cargoNextestExtraArgs} ${moreArgs}
${if withLlvmCov
then "cargo llvm-cov nextest ${cargoLlvmCovExtraArgs}"
else "cargo nextest ${cmd}"} \
''${CARGO_PROFILE:+--cargo-profile $CARGO_PROFILE} \
${cargoExtraArgs} ${cargoNextestExtraArgs} ${moreArgs}
'';

nativeBuildInputs = (args.nativeBuildInputs or [ ])
Expand Down