Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions benches/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use memory_fs::BenchMemoryFS;

fn data() -> Vec<(PathBuf, &'static str)> {
let cwd = env::current_dir().unwrap();
let f1 = cwd.join("fixtures/enhanced_resolve");
let f1 = cwd.join("fixtures/enhanced-resolve");
let f2 = f1.join("test/fixtures");
vec![
// real packages
Expand Down Expand Up @@ -82,7 +82,7 @@ fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(original: P, link: Q) -> io::Result<(
}

fn create_symlinks() -> io::Result<PathBuf> {
let root = env::current_dir()?.join("fixtures/enhanced_resolve");
let root = env::current_dir()?.join("fixtures/enhanced-resolve");
let dirname = root.join("test");
let temp_path = dirname.join("temp_symlinks");
let create_symlink_fixtures = || -> io::Result<()> {
Expand Down Expand Up @@ -160,7 +160,7 @@ fn oxc_resolver_real() -> oxc_resolver::Resolver {
fn bench_resolver_memory(c: &mut Criterion) {
let data = data();
let cwd = env::current_dir().unwrap();
let symlink_test_dir = cwd.join("fixtures/enhanced_resolve/test/temp_symlinks");
let symlink_test_dir = cwd.join("fixtures/enhanced-resolve/test/temp_symlinks");

// check validity
for (path, request) in &data {
Expand Down Expand Up @@ -370,7 +370,7 @@ fn bench_package_json_deserialization(c: &mut Criterion) {
// Load real complex package.json from fixtures
let complex_json_path = env::current_dir()
.unwrap()
.join("fixtures/enhanced_resolve/test/fixtures/browser-module/package.json");
.join("fixtures/enhanced-resolve/test/fixtures/browser-module/package.json");
let complex_json =
fs::read_to_string(&complex_json_path).expect("Failed to read complex package.json");

Expand Down Expand Up @@ -466,8 +466,8 @@ mod memory_fs {
// Add all parent directories for the cwd
self.add_parent_directories(&cwd);

// Load fixtures from enhanced_resolve
let fixtures_base = cwd.join("fixtures/enhanced_resolve");
// Load fixtures from enhanced-resolve
let fixtures_base = cwd.join("fixtures/enhanced-resolve");
if fixtures_base.exists() {
for entry in WalkDir::new(&fixtures_base)
.follow_links(false)
Expand Down Expand Up @@ -601,7 +601,7 @@ mod memory_fs {

fn create_symlink_fixtures(&mut self, cwd: &Path) {
// Create temp_symlinks directory
let temp_path = cwd.join("fixtures/enhanced_resolve/test/temp_symlinks");
let temp_path = cwd.join("fixtures/enhanced-resolve/test/temp_symlinks");
self.directories.insert(temp_path.clone());
self.add_parent_directories(&temp_path);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
},
"references": [
{
"path": "../project_a/conf.json"
"path": "../project-a/conf.json"
},
{
"path": "../project_b"
"path": "../project-b"
},
{
"path": "../project_c/tsconfig.json"
"path": "../project-c/tsconfig.json"
},
{
"path": "../../paths_template_variable/tsconfig.json"
"path": "../../paths-template-variable/tsconfig.json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./"
},
"references": [
{
"path": "../project-a/conf.json"
},
{
"path": "../project-b"
},
{
"path": "../project-c/tsconfig.json"
},
{
"path": "../../paths-template-variable/tsconfig.json"
}
]
}

This file was deleted.

2 changes: 1 addition & 1 deletion napi/tests/file-protocol.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const rootDir = join(currentDir, '..', '..');
const fixturesDir = join(rootDir, 'fixtures');
const enhancedResolveRoot = join(
fixturesDir,
'enhanced_resolve',
'enhanced-resolve',
'test',
'fixtures',
);
Expand Down
2 changes: 1 addition & 1 deletion napi/tests/options.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { normalizePath } from './utils.mjs';

const fixtureDir = path.resolve(
import.meta.dirname,
'../../fixtures/enhanced_resolve/test/fixtures',
'../../fixtures/enhanced-resolve/test/fixtures',
);

describe('option', () => {
Expand Down
8 changes: 4 additions & 4 deletions napi/tests/resolver.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const fixturesDir = join(rootDir, 'fixtures');

const enhancedResolveRoot = join(
fixturesDir,
'enhanced_resolve',
'enhanced-resolve',
'test',
'fixtures',
);
Expand Down Expand Up @@ -86,13 +86,13 @@ for (
],
[
'from nested directory to overwritten file in module',
join(enhancedResolveRoot, 'multiple_modules'),
join(enhancedResolveRoot, 'multiple-modules'),
'm1/a.js',
join(enhancedResolveRoot, 'multiple_modules/node_modules/m1/a.js'),
join(enhancedResolveRoot, 'multiple-modules/node_modules/m1/a.js'),
],
[
'from nested directory to not overwritten file in module',
join(enhancedResolveRoot, 'multiple_modules'),
join(enhancedResolveRoot, 'multiple-modules'),
'm1/b.js',
join(enhancedResolveRoot, 'node_modules/m1/b.js'),
],
Expand Down
2 changes: 1 addition & 1 deletion src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn fixture_root() -> PathBuf {
}

pub fn fixture() -> PathBuf {
fixture_root().join("enhanced_resolve").join("test").join("fixtures")
fixture_root().join("enhanced-resolve").join("test").join("fixtures")
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/tests/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ fn resolve() {
("file in module without extension", f.clone(), "m1/a", f.join("node_modules/m1/a.js")),
("another file in module without extension", f.clone(), "complexm/step1", f.join("node_modules/complexm/step1.js")),
("from submodule to file in sibling module", f.join("node_modules/complexm"), "m2/b.js", f.join("node_modules/m2/b.js")),
("from nested directory to overwritten file in module", f.join("multiple_modules"), "m1/a.js", f.join("multiple_modules/node_modules/m1/a.js")),
("from nested directory to not overwritten file in module", f.join("multiple_modules"), "m1/b.js", f.join("node_modules/m1/b.js")),
("from nested directory to overwritten file in module", f.join("multiple-modules"), "m1/a.js", f.join("multiple-modules/node_modules/m1/a.js")),
("from nested directory to not overwritten file in module", f.join("multiple-modules"), "m1/b.js", f.join("node_modules/m1/b.js")),
("file with query", f.clone(), "./main1.js?query", f.join("main1.js?query")),
("file with fragment", f.clone(), "./main1.js#fragment", f.join("main1.js#fragment")),
("file with fragment and query", f.clone(), "./main1.js#fragment?query", f.join("main1.js#fragment?query")),
Expand Down
4 changes: 2 additions & 2 deletions src/tests/roots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::path::PathBuf;
use crate::{AliasValue, ResolveError, ResolveOptions, Resolver};

fn dirname() -> PathBuf {
super::fixture_root().join("enhanced_resolve").join("test")
super::fixture_root().join("enhanced-resolve").join("test")
}

#[test]
Expand Down Expand Up @@ -82,7 +82,7 @@ fn prefer_absolute() {
#[test]
fn roots_fall_through() {
let f = super::fixture();
let absolute_path = f.join("roots_fall_through/index.js");
let absolute_path = f.join("roots-fall-through/index.js");
let specifier = absolute_path.to_string_lossy();
let resolution = Resolver::new(ResolveOptions::default().with_root(&f)).resolve(&f, &specifier);
assert_eq!(
Expand Down
6 changes: 3 additions & 3 deletions src/tests/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ fn resolve_abs_main() {
fn simple() {
// mimic `enhanced-resolve/test/simple.test.js`
let dirname = env::current_dir().unwrap().join("fixtures");
let f = dirname.join("enhanced_resolve/test");
let f = dirname.join("enhanced-resolve/test");

let resolver = Resolver::default();

let data = [
("direct", f.clone(), "../lib/index"),
("as directory", f, ".."),
("as module", dirname.clone(), "./enhanced_resolve"),
("as module", dirname.clone(), "./enhanced-resolve"),
];

for (comment, path, request) in data {
let resolved_path = resolver.resolve(&path, request).map(|f| f.full_path());
let expected = dirname.join("enhanced_resolve/lib/index.js");
let expected = dirname.join("enhanced-resolve/lib/index.js");
assert_eq!(resolved_path, Ok(expected), "{comment} {path:?} {request}");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct SymlinkFixturePaths {
fn prepare_symlinks<P: AsRef<Path>>(
temp_path_segment: P,
) -> io::Result<Option<SymlinkFixturePaths>> {
let root = super::fixture_root().join("enhanced_resolve");
let root = super::fixture_root().join("enhanced-resolve");
let dirname = root.join("test");
let temp_path = dirname.join(temp_path_segment.as_ref());
if !temp_path.exists() {
Expand Down
6 changes: 3 additions & 3 deletions src/tests/tsconfig_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ fn test_paths_and_base_url() {
#[test]
fn test_merge_tsconfig() {
let resolver = Resolver::default();
let dir = super::fixture_root().join("tsconfig/cases/merge_compiler_options");
let dir = super::fixture_root().join("tsconfig/cases/merge-compiler-options");
let resolution = resolver.resolve_tsconfig(&dir).expect("resolved");
let compiler_options = &resolution.compiler_options;
assert_eq!(compiler_options.experimental_decorators, Some(true));
Expand All @@ -291,7 +291,7 @@ fn test_merge_tsconfig() {
#[test]
fn test_no_merge_tsconfig() {
let resolver = Resolver::default();
let dir = super::fixture_root().join("tsconfig/cases/no_merge_compiler_options");
let dir = super::fixture_root().join("tsconfig/cases/no-merge-compiler-options");
let resolution = resolver.resolve_tsconfig(&dir).expect("resolved");
let compiler_options = &resolution.compiler_options;
assert_eq!(compiler_options.experimental_decorators, Some(true));
Expand All @@ -306,7 +306,7 @@ fn test_no_merge_tsconfig() {
#[test]
fn test_template_variable() {
let f = super::fixture_root().join("tsconfig");
let f2 = f.join("cases").join("paths_template_variable");
let f2 = f.join("cases").join("paths-template-variable");

#[rustfmt::skip]
let pass = [
Expand Down
Loading
Loading