GeezerVison is showing github.com — Fix tests broken by the feat/gradle-support merge · SocketDev/socket-patch@4a92588
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/src/commands/vex_consumed.rs +15-4Lines changed: 15 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -729,8 +729,11 @@ mod tests { | 729 | 729 | None, | 730 | 730 | ) | 731 | 731 | .await; | 732 | | - assert_eq!(installed_again, installed); | 733 | | - let (paths, calls) = tracked_npm_hosted(&common, &installed_again).await; | | 732 | + // Since #605 the name-keyed resolver probes bundled trees itself, so | | 733 | + // it already returns the aliases and the nested store's peers. Feed | | 734 | + // the earlier, alias-free set to keep exercising alias expansion; | | 735 | + // the resolver's own set is checked against the same result below. | | 736 | + let (paths, calls) = tracked_npm_hosted(&common, &installed).await; | 734 | 737 | assert_eq!(calls.len(), 1); | 735 | 738 | let mut inputs = calls[0].clone(); | 736 | 739 | inputs.sort(); | @@ -752,6 +755,9 @@ mod tests { | 752 | 755 | .len(), | 753 | 756 | paths.len() | 754 | 757 | ); | | 758 | + let (mut resolved, _) = tracked_npm_hosted(&common, &installed_again).await; | | 759 | + resolved.sort(); | | 760 | + assert_eq!(resolved, expected, "the resolver's own copy set"); | 755 | 761 | } | 756 | 762 |
| 757 | 763 | #[cfg(unix)] | @@ -782,14 +788,19 @@ mod tests { | 782 | 788 | None, | 783 | 789 | ) | 784 | 790 | .await; | 785 | | - assert!(installed.is_empty(), "{installed:?}"); | 786 | | - let (mut paths, calls) = tracked_npm_hosted(&common, &installed).await; | | 791 | + // Since #605 the name-keyed resolver reaches the alias and its | | 792 | + // sibling peers on its own. An alias-only set (what an alias-blind | | 793 | + // resolver returns) must still expand to the same copies. | | 794 | + let (mut paths, calls) = tracked_npm_hosted(&common, &HashMap::new()).await; | 787 | 795 | assert_eq!(calls, vec![vec![alias.clone()]]); | 788 | 796 | let mut expected = peers; | 789 | 797 | expected.push(alias); | 790 | 798 | paths.sort(); | 791 | 799 | expected.sort(); | 792 | 800 | assert_eq!(paths, expected); | | 801 | + let (mut resolved, _) = tracked_npm_hosted(&common, &installed).await; | | 802 | + resolved.sort(); | | 803 | + assert_eq!(resolved, expected, "the resolver's own copy set"); | 793 | 804 | } | 794 | 805 |
| 795 | 806 | #[cfg(unix)] | |
Collapse file Copy file name to clipboardExpand all lines: crates/socket-patch-cli/tests/e2e_sbt_vendor.rs +22-13Lines changed: 22 additions & 13 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -609,8 +609,9 @@ fn vendor_forged_ledger_touches_nothing() { | 609 | 609 | } | 610 | 610 | } | 611 | 611 |
| 612 | | -/// The generated file or the tree symlinked out of the checkout is refused | 613 | | -/// with `build_file_outside_root`, and nothing is written through it. | | 612 | +/// The generated file symlinked out of the checkout is refused with | | 613 | +/// `build_file_outside_root` (a linked `.socket/vendor` with the shared | | 614 | +/// `vendor_dir_symlink_unsupported`), and nothing is written through it. | 614 | 615 | #[cfg(unix)] | 615 | 616 | #[test] | 616 | 617 | fn vendor_escaping_symlinks_are_refused() { | @@ -627,17 +628,25 @@ fn vendor_escaping_symlinks_are_refused() { | 627 | 628 | std::os::unix::fs::symlink(&target, fx.proj().join(link)).unwrap(); | 628 | 629 | let (code, env) = fx.run(&["vendor"]); | 629 | 630 | assert_ne!(code, Some(0), "{link}: {env}"); | 630 | | - assert_eq!( | 631 | | - env["events"][0]["errorCode"], "vendor_jvm_shape_unsupported", | 632 | | - "{link}: {env}" | 633 | | - ); | 634 | | - assert!( | 635 | | - env["events"][0]["error"] | 636 | | - .as_str() | 637 | | - .unwrap_or_default() | 638 | | - .starts_with("reason: build_file_outside_root: "), | 639 | | - "{link}: {env}" | 640 | | - ); | | 631 | + if link == ".socket/vendor" { | | 632 | + // Every ecosystem refuses a linked vendor dir up front (#664). | | 633 | + assert_eq!( | | 634 | + env["events"][0]["errorCode"], "vendor_dir_symlink_unsupported", | | 635 | + "{link}: {env}" | | 636 | + ); | | 637 | + } else { | | 638 | + assert_eq!( | | 639 | + env["events"][0]["errorCode"], "vendor_jvm_shape_unsupported", | | 640 | + "{link}: {env}" | | 641 | + ); | | 642 | + assert!( | | 643 | + env["events"][0]["error"] | | 644 | + .as_str() | | 645 | + .unwrap_or_default() | | 646 | + .starts_with("reason: build_file_outside_root: "), | | 647 | + "{link}: {env}" | | 648 | + ); | | 649 | + } | 641 | 650 | assert_eq!( | 642 | 651 | std::fs::read_dir(&outside).unwrap().count(), | 643 | 652 | 0, | |
|