Skip to content

Commit

Permalink
test: add a test for defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Oct 8, 2023
1 parent 8f18688 commit 49d90fb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
21 changes: 21 additions & 0 deletions packages/node-resolve/test/snapshots/test.mjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ The actual snapshot is saved in `test.mjs.snap`.

Generated by [AVA](https://avajs.dev).

## has default config

> Snapshot 1
{
allowExportsFolderMapping: true,
dedupe: [],
extensions: [
'.mjs',
'.js',
'.json',
'.node',
],
ignoreSideEffectsForRoot: false,
moduleDirectories: [
'node_modules',
],
modulePaths: [],
resolveOnly: [],
}

## throws error if local id is not resolved

> Snapshot 1
Expand Down
Binary file modified packages/node-resolve/test/snapshots/test.mjs.snap
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/node-resolve/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import commonjs from '@rollup/plugin-commonjs';
import test from 'ava';
import { rollup } from 'rollup';

import { nodeResolve } from 'current-package';
import { nodeResolve, DEFAULTS } from 'current-package';

import { evaluateBundle, getCode, getImports, testBundle } from '../../../util/test.js';

Expand All @@ -23,6 +23,10 @@ test('exposes plugin version', (t) => {
t.regex(plugin.version, /^\d+\.\d+\.\d+/);
});

test('has default config', (t) => {
t.snapshot(DEFAULTS);
});

test('finds a module with jsnext:main', async (t) => {
const bundle = await rollup({
input: 'jsnext.js',
Expand Down

0 comments on commit 49d90fb

Please sign in to comment.