ipetkov / crane

A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
https://crane.dev
MIT License
926 stars 88 forks source link

Cannot set `cargoExtraArgs` in `craneLib.cargoNextest` #675

Closed skarmux closed 2 months ago

skarmux commented 2 months ago

https://github.com/ipetkov/crane/blob/529c1a0b1f29f0d78fa3086b8f6a134c71ef3aaf/lib/cargoNextest.nix#L46-L51

$ cargo nextest run -h
--
Build and run tests

Usage: cargo nextest run [OPTIONS] [FILTERS]... [-- <FILTERS_AND_ARGS>...]
[...]

As stated in the documentation of the cargo-nextest crate, any extra argument/option is to be set behind $ cargo nextest run. The nextest call appears to take mostly the same arguments as cargo does, which is why I got away with placing my cargo extra arguments (--feature <xyz>) in cargoNextestExtraArgs without any issue.

If any cargoExtraArgs (or llvm-cov) is placed between $ cargo <here> nextest run it results in an invalid command structure. I figure both can be removed from craneLib.cargoNextest and the corresponding documentation without losing functionality.

I'll gladly do the work if I haven't missed something.

ipetkov commented 2 months ago

Hi @skarmux thanks for the report!

I think I had missed that part of the documentation when writing the original integration (I suppose I mistakenly assumed just because cargo supports options like cargo <here> build <etc>, then nextest would do...), so if that's the right way to make things work I'd definitely be happy to review a PR to get it fixed!

skarmux commented 2 months ago

Okay, this will be my first ever PR. It's assigned to this issue. I've ran nix flake check and everything went through. Also used the forked repo in my personal project as input and the barebones craneLib.cargoNextest check passed there as well.