cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Ability to test against registry dependencies, instead of path dependencies

Open barakugav opened this issue 6 months ago • 1 comments

Problem

I have a monorepo with multiple Rust crates that depends on one another with both a path and version dependency. An example for a line in Cargo.toml:

my_crate_dep = {path = "../my_crate_dep", version="1.0.0"}

The behaviour of cargo to ignore the version during development and ignore the path during publish or package is amazing! When I run cargo package the crate it built with my_crate_dep from crates.io, and not my local dependency. I would also like to cargo test with my_crate_dep from crates.io rather than local, in addition to the build.

Proposed Solution

One of the following will provide what I need:

  • Add a flag to cargo test indicating to ignore path/git dependencies, maybe along the lines of --force-published-deps.
  • Add a flag to cargo package to run tests

Notes

Actually I think such flags can be useful in many sub commands of cargo, maybe we should consider a wide option

barakugav avatar Aug 20 '24 08:08 barakugav