diff --git a/crates/socket-patch-core/src/patch/redirect/yarnrc_tests.rs b/crates/socket-patch-core/src/patch/redirect/yarnrc_tests.rs index b39393c0c..6e975243d 100644 --- a/crates/socket-patch-core/src/patch/redirect/yarnrc_tests.rs +++ b/crates/socket-patch-core/src/patch/redirect/yarnrc_tests.rs @@ -586,16 +586,19 @@ fn global_folder_values_read_like_yarn() { Vec::::new() ); // An escaped expression stays verbatim (`ini` reads `\\` as `\` - // first). + // first). On Windows the leading `\` makes it root-relative: it keeps + // the cwd's drive and replaces the rest, as `path.resolve` does + // (`/w` has no drive, so nothing of it is kept). + let escaped = if cfg!(windows) { + "\\${HOME}/x" + } else { + "/w/\\${HOME}/x" + }; for text in [ "global-folder=\\${HOME}/x\n", "global-folder=\\\\${HOME}/x\n", ] { - assert_eq!( - npmrc(Host::new(), text), - paths(&["/w/\\${HOME}/x"]), - "{text:?}" - ); + assert_eq!(npmrc(Host::new(), text), paths(&[escaped]), "{text:?}"); } // `ini` ends an unquoted value at a comment and unquotes a quoted one. assert_eq!(