Skip to content

Commit

Permalink
add missing extension test
Browse files Browse the repository at this point in the history
  • Loading branch information
tjenkinson committed Dec 2, 2020
1 parent 8c3a3a6 commit 965bce9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/node-resolve/test/fixtures/missing-extension.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import uppercase from 'string/uppercase';

export default uppercase('foo');
11 changes: 11 additions & 0 deletions packages/node-resolve/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ test('handles a trailing slash', async (t) => {
t.is(module.exports, 'It works!');
});

test('handles missing js extension', async (t) => {
const bundle = await rollup({
input: 'missing-extension.js',
onwarn: () => t.fail('No warnings were expected'),
plugins: [nodeResolve({ mainFields: ['main'] }), commonjs()]
});
const { module } = await testBundle(t, bundle);

t.is(module.exports, 'FOO');
});

test('finds a file inside a package directory', async (t) => {
const bundle = await rollup({
input: 'granular.js',
Expand Down

0 comments on commit 965bce9

Please sign in to comment.