-
Notifications
You must be signed in to change notification settings - Fork 27.6k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { esm, esmPlain, loadInvalidCjs, loadInvalidEsm } from 'esm-package' | ||
import { auto, autoPlain } from 'auto-package' | ||
|
||
it('should have the commonjs module as default export in specified ESM', () => { | ||
expect(esm).toMatchObject({ | ||
__esModule: true, | ||
named: 'named', | ||
}) | ||
expect(esmPlain).toMatchObject({ | ||
named: 'named', | ||
}) | ||
}) | ||
|
||
it('should not have the commonjs module as default export in specified ESM', () => { | ||
expect(auto).toMatchObject({ | ||
__esModule: true, | ||
named: 'named', | ||
}) | ||
expect(autoPlain).toMatchObject({ | ||
named: 'named', | ||
}) | ||
}) | ||
|
||
it('should error for invalid esm exports', async () => { | ||
let value = await loadInvalidEsm() | ||
expect(value).toMatchObject({ | ||
__esModule: true, | ||
}) | ||
}) | ||
|
||
it('should error for invalid cjs exports', async () => { | ||
let value = await loadInvalidCjs() | ||
expect(value).toMatchObject({ | ||
__esModule: true, | ||
named: 'named', | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
PlainIssue { | ||
severity: Error, | ||
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.cjs", | ||
category: "module type", | ||
title: "Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules)", | ||
description: "The CommonJs module format was specified in the package.json that is affecting this source file or by using an special extension, but Ecmascript import/export syntax is used in the source code.\nThe module was automatically converted to an EcmaScript module, but that is in conflict with the specified module format. Either change the \"type\" field in the package.json or replace EcmaScript import/export syntax with CommonJs syntas in the source file.\nIn some cases EcmaScript import/export syntax is added by an transform and isn't actually part of the source code. In these cases revisit transformation options to inject the correct syntax.", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
processing_path: Some( | ||
[], | ||
), | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
PlainIssue { | ||
severity: Warning, | ||
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/turbopack/basic/node-default-import/input/node_modules/esm-package/invalid-exports.js", | ||
category: "module type", | ||
title: "Specified module format (EcmaScript Modules) is not matching the module format of the source code (CommonJs)", | ||
description: "The EcmaScript module format was specified in the package.json that is affecting this source file or by using an special extension, but it looks like that CommonJs syntax is used in the source code.\nExports made by CommonJs syntax will lead to a runtime error, since the module is in EcmaScript mode. Either change the \"type\" field in the package.json or replace CommonJs syntax with EcmaScript import/export syntax in the source file.", | ||
detail: "", | ||
documentation_link: "", | ||
source: None, | ||
sub_issues: [], | ||
processing_path: Some( | ||
[], | ||
), | ||
} |