Skip to content

Commit 2a67412

Browse files
committed
chore: better napi test.mjs usage (#19)
1 parent dd3d43c commit 2a67412

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

napi/test.mjs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import resolve, { ResolverFactory } from './index.js';
44

55
console.log(`Testing on ${process.platform}-${process.arch}`);
66

7-
const cwd = process.cwd();
7+
const dir = import.meta.dirname;
88

99
// `resolve`
10-
assert.deepStrictEqual(resolve.sync(cwd, './index.js').path, path.join(cwd, 'index.js'));
10+
assert.deepStrictEqual(resolve.sync(dir, './index.js').path, path.join(dir, 'index.js'));
1111

1212
// `ResolverFactory`
1313
const resolver = new ResolverFactory();
14-
assert.deepStrictEqual(resolver.sync(cwd, './index.js').path, path.join(cwd, 'index.js'));
14+
assert.deepStrictEqual(resolver.sync(dir, './index.js').path, path.join(dir, 'index.js'));
1515

16-
assert.strict(resolver.sync(cwd, './ts').error.length > 0);
16+
assert.strict(resolver.sync(dir, './ts').error.length > 0);
1717

18-
resolver.async(cwd, './ts')
18+
resolver.async(dir, './ts')
1919
.then((result) => assert.strict(result.error.length > 0));
2020

2121
const newResolver = resolver.cloneWithOptions({});
@@ -29,4 +29,4 @@ const resolver2 = new ResolverFactory(
2929
);
3030

3131
// After add `.ts` extension, resolver can resolve `ts` as `ts.ts` now
32-
assert.deepStrictEqual(resolver2.sync(cwd, './test.mjs').path, path.join(cwd, 'test.mjs'));
32+
assert.deepStrictEqual(resolver2.sync(dir, './test.mjs').path, path.join(dir, 'test.mjs'));

src/file_system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl FileSystem for FileSystemOs {
295295
VPath::Virtual(info) => dunce::canonicalize(info.physical_base_path()),
296296
VPath::Native(path) => dunce::canonicalize(path),
297297
}
298-
}
298+
}
299299
}
300300
}
301301

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ impl<C: Cache + Default> Default for ResolverGeneric<C> {
148148
impl<C: Cache + Default> ResolverGeneric<C> {
149149
#[must_use]
150150
pub fn new(options: ResolveOptions) -> Self {
151-
println!("enable_pnp: {:?}", options.enable_pnp);
152151
Self {
153152
options: options.sanitize(),
154153
cache: Arc::new(C::default()),

0 commit comments

Comments
 (0)