aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/bundler/bundler_cjs2esm.test.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/bundler/bundler_cjs2esm.test.ts b/test/bundler/bundler_cjs2esm.test.ts
index 7ccd6057a..51a8e00d0 100644
--- a/test/bundler/bundler_cjs2esm.test.ts
+++ b/test/bundler/bundler_cjs2esm.test.ts
@@ -21,6 +21,57 @@ describe("bundler", () => {
stdout: "foo",
},
});
+ itBundled("cjs2esm/ImportNamedFromExportStarCJSModuleRef", {
+ files: {
+ "/entry.js": /* js */ `
+ import { foo } from './foo';
+ console.log(foo);
+ `,
+ "/foo.js": /* js */ `
+ export * from './bar.cjs';
+ `,
+ "/bar.cjs": /* js */ `
+ module.exports.foo = 'bar';
+ `,
+ },
+ run: {
+ stdout: "bar",
+ },
+ });
+ itBundled("cjs2esm/ImportNamedFromExportStarCJS", {
+ files: {
+ "/entry.js": /* js */ `
+ import { foo } from './foo';
+ console.log(foo);
+ `,
+ "/foo.js": /* js */ `
+ export * from './bar.cjs';
+ `,
+ "/bar.cjs": /* js */ `
+ exports.foo = 'bar';
+ `,
+ },
+ run: {
+ stdout: "bar",
+ },
+ });
+ itBundled("cjs2esm/BadNamedImportNamedReExportedFromCommonJS", {
+ files: {
+ "/entry.js": /* js */ `
+ import {bad} from './foo';
+ console.log(bad);
+ `,
+ "/foo.js": /* js */ `
+ export {bad} from './bar.cjs';
+ `,
+ "/bar.cjs": /* js */ `
+ exports.foo = 'bar';
+ `,
+ },
+ run: {
+ stdout: "undefined",
+ },
+ });
itBundled("cjs2esm/ExportsFunction", {
files: {
"/entry.js": /* js */ `