Skip to content

Commit

Permalink
Test npm protocol in dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
riquito committed Mar 29, 2024
1 parent ca7c7b7 commit b2a04aa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __metadata:
resolution: "foo@workspace:."
dependencies:
foolib: 1.2.3 || ^2.0.0
buzz: "npm:^1.1.1"
languageName: unknown
linkType: soft
Expand All @@ -21,6 +22,13 @@ __metadata:
checksum: 123061e52a0b3792c6a0472bf48ca6c337ccb58e92261049e7727a12c326b9627537e2ef8cb4453354d02c763b87c8b516f4eedfad99945c308927285bbc12ba
languageName: node
linkType: hard
"buzz@npm:^1.1.1":
version: 1.1.2
resolution: "buzz@npm:1.1.2"
checksum: 58e92261049e7727a12c326b9627537e123061e52a0b3792c6a0472bf48ca6c337ccb2ef8cb4453354d02c763b87c8b516f4eedfad99945c308927285bbc12ba
languageName: node
linkType: hard
"#;

const YARN_LOCK_V6_ONLY_DIRECT_DEPS: &str = r#"# This file is generated by running "yarn install" inside your project.
Expand Down Expand Up @@ -100,6 +108,22 @@ fn it_finds_a_package_without_range() {
);
}

#[test]
fn it_finds_a_package_whose_dep_is_using_npm_protocol() {
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();

let assert = cmd
.args(["buzz"])
.write_stdin(YARN_LOCK_V6_WITH_DEPS)
.assert();

assert.success().stdout(
r#"└─ foo@.
└─ buzz@^1.1.1
"#,
);
}

#[test]
fn it_finds_a_package_in_a_yarn_lock_with_only_direct_deps() {
let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
Expand Down

0 comments on commit b2a04aa

Please sign in to comment.