Skip to content

Commit e51af28

Browse files
committed
fix: incorrect test case path
1 parent 47698b6 commit e51af28

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

fixtures/global-cache/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log(require.resolve('source-map-support'));

src/lib_tests.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct TestSuite {
1818

1919
#[cfg(test)]
2020
mod tests {
21-
use std::{fs, path::PathBuf};
21+
use std::{env, fs, path::PathBuf};
2222

2323
use super::*;
2424
use crate::{
@@ -166,21 +166,32 @@ mod tests {
166166

167167
#[test]
168168
fn test_global_cache() {
169-
let manifest = load_pnp_manifest("fixtures/global-cache/.pnp.cjs").unwrap();
169+
let manifest = load_pnp_manifest(
170+
env::current_dir()
171+
.unwrap()
172+
.join("fixtures/global-cache/.pnp.cjs"),
173+
)
174+
.unwrap();
170175

171176
let global_cache = dirs::home_dir().unwrap().join(".yarn/berry/cache");
172177

173-
let result = resolve_to_unqualified_via_manifest(&manifest, "source-map", global_cache.join("source-map-support-npm-0.5.21-09ca99e250-9ee09942f4.zip/node_modules/source-map-support/"));
178+
let result = resolve_to_unqualified_via_manifest(
179+
&manifest,
180+
"source-map",
181+
global_cache.join(
182+
"source-map-support-npm-0.5.21-09ca99e250-10c0.zip/node_modules/source-map-support/",
183+
),
184+
);
174185

175186
match result {
176187
Ok(Resolution::Resolved(path, subpath)) => {
177188
assert_eq!(
178189
path,
179190
global_cache.join(
180-
"source-map-npm-0.6.1-1a3621db16-ab55398007.zip/node_modules/source-map"
191+
"source-map-npm-0.6.1-1a3621db16-10c0.zip/node_modules/source-map/"
181192
)
182193
);
183-
assert_eq!(subpath, Some("source-map.js".into()));
194+
assert_eq!(subpath, None);
184195
}
185196
_ => {
186197
panic!("Unexpected resolve failed");

0 commit comments

Comments
 (0)