Skip to content

Ability to test against registry dependencies, instead of path dependencies #14429

Open
@barakugav

Description

@barakugav

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dependency-resolutionArea: dependency resolution and the resolverC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-packageCommand-testS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions