Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(commonjs)!: default strictRequires to true #1639

Merged
merged 15 commits into from
Sep 23, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: adapt assertion
While the error message has a different variable name, the point of
the test is that we get an error.
  • Loading branch information
lukastaegert committed Jan 19, 2024
commit 00fabc0827f2f5a6d3c95e571395e87b2b4225bb
10 changes: 4 additions & 6 deletions packages/commonjs/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,12 @@ test('converts a CommonJS module with custom file extension', async (t) => {
t.is((await executeBundle(bundle, t)).exports, 42);
});

test('import CommonJS module with esm property should get default export (strictRequires: "auto")', async (t) => {
test('import CommonJS module with esm property should get default export ', async (t) => {
const bundle = await rollup({
input: 'fixtures/samples/cjs-with-esm-property/main.js',
plugins: [
commonjs({
defaultIsModuleExports: 'auto',
strictRequires: 'auto'
defaultIsModuleExports: 'auto'
})
]
});
Expand All @@ -282,13 +281,12 @@ test('import CommonJS module with esm property should get default export (strict
input: 'fixtures/samples/cjs-with-esm-property/main.js',
plugins: [
commonjs({
defaultIsModuleExports: true,
strictRequires: 'auto'
defaultIsModuleExports: true
})
]
});
const result2 = await executeBundle(bundle2, t);
t.is(result2.error.message, 'lib is not a function');
t.is(result2.error.message, 'libExports is not a function');
});

test('identifies named exports from object literals', async (t) => {
Expand Down