Skip to content

Commit

Permalink
chore: add test case for tsconfig paths alias fall through
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Apr 24, 2024
1 parent 7866055 commit 4ce19f4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/tests/tsconfig_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
use std::path::{Path, PathBuf};

use crate::{ResolveOptions, Resolver, TsConfig, TsconfigOptions, TsconfigReferences};
use crate::{
ResolveError, ResolveOptions, Resolver, TsConfig, TsconfigOptions, TsconfigReferences,
};

// <https://github.com/parcel-bundler/parcel/blob/b6224fd519f95e68d8b93ba90376fd94c8b76e69/packages/utils/node-resolver-rs/src/lib.rs#L2303>
#[test]
Expand Down Expand Up @@ -56,6 +58,22 @@ fn tsconfig() {
}
}

#[test]
fn tsconfig_fallthrough() {
let f = super::fixture_root().join("tsconfig");

let resolver = Resolver::new(ResolveOptions {
tsconfig: Some(TsconfigOptions {
config_file: f.join("tsconfig.json"),
references: TsconfigReferences::Auto,
}),
..ResolveOptions::default()
});

let resolved_path = resolver.resolve(&f, "/");
assert_eq!(resolved_path, Err(ResolveError::NotFound("/".into())));
}

#[test]
fn json_with_comments() {
let f = super::fixture_root().join("tsconfig/cases/trailing-comma");
Expand Down

0 comments on commit 4ce19f4

Please sign in to comment.