Skip to content

Commit 9533a45

Browse files
committed
improve: add comments to test cases
1 parent 5f6bbc8 commit 9533a45

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,29 @@ const pluginPreserveExtensions = typescriptPaths({
1818
});
1919

2020
try {
21+
// skips if a matching path alias isn't found
2122
strictEqual(plugin.resolveId('@asdf', ''), null);
23+
24+
// skips if importee is a virtual module
2225
strictEqual(plugin.resolveId('\0@foobar', ''), null);
26+
27+
// works with non-wildcard paths
2328
strictEqual(plugin.resolveId('@foobar', ''), join(__dirname, 'foo', 'bar.js'));
2429
strictEqual(plugin.resolveId('@foobar-react', ''), join(__dirname, 'foo', 'bar-react.js'));
30+
31+
// works with wildcard paths
2532
strictEqual(plugin.resolveId('@bar/foo', ''), join(__dirname, 'bar', 'foo.js'));
33+
34+
// works with a directory with index file
2635
strictEqual(plugin.resolveId('@js', ''), join(__dirname, 'js', 'index.js'));
2736

37+
// returns relative paths with option `absolute: false`
2838
strictEqual(pluginNonAbs.resolveId('@foobar', ''), join('test', 'foo', 'bar.js'));
2939

40+
// applies function from `transform` option
3041
strictEqual(pluginTransform.resolveId('@foobar', ''), join(__dirname, 'foo', 'bar.cjs.js'));
3142

43+
// resolves including the file extension with option `preserveExtensions: true`
3244
strictEqual(pluginPreserveExtensions.resolveId('@foobar', ''), join(__dirname, 'foo', 'bar.ts'));
3345
strictEqual(pluginPreserveExtensions.resolveId('@foobar-react', ''), join(__dirname, 'foo', 'bar-react.tsx'));
3446

0 commit comments

Comments
 (0)