Skip to content

Commit 6b9a7cf

Browse files
authored
test: add a tsconfig extend not found case (#763)
1 parent 5654bce commit 6b9a7cf

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/tests/tsconfig_paths.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,31 @@ fn tsconfig_resolve() {
4343
assert_eq!(resolved_path, Ok(expected), "{request} {path:?}");
4444
}
4545

46-
#[rustfmt::skip]
4746
let data = [
48-
(f.join("node_modules/tsconfig-not-used"), "ts-path", Err(ResolveError::NotFound("ts-path".to_string()))),
47+
(
48+
f.join("node_modules/tsconfig-not-used"),
49+
"ts-path",
50+
f.join("tsconfig.json"),
51+
Err(ResolveError::NotFound("ts-path".to_string())),
52+
),
53+
(
54+
f.join("cases/extends-not-found"),
55+
"ts-path",
56+
f.join("cases").join("extends-not-found").join("tsconfig_json.json"),
57+
Err(ResolveError::TsconfigNotFound(
58+
f.join("cases").join("extends-not-found").join("tsconfig_json.json"),
59+
)),
60+
),
4961
];
5062

51-
let resolver = Resolver::new(ResolveOptions {
52-
tsconfig: Some(TsconfigOptions {
53-
config_file: f.join("tsconfig.json"),
54-
references: TsconfigReferences::Auto,
55-
}),
56-
..ResolveOptions::default()
57-
});
58-
for (path, request, expected) in data {
63+
for (path, request, tsconfig, expected) in data {
64+
let resolver = Resolver::new(ResolveOptions {
65+
tsconfig: Some(TsconfigOptions {
66+
config_file: tsconfig,
67+
references: TsconfigReferences::Auto,
68+
}),
69+
..ResolveOptions::default()
70+
});
5971
let resolution = resolver.resolve(&path, request).map(|f| f.full_path());
6072
assert_eq!(resolution, expected, "{path:?} {request}");
6173
}

0 commit comments

Comments
 (0)