aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-12 07:27:03 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-12 07:27:03 -0700
commitf6bbfb16fd011bc3d24c9fb29032bebb9b2fae0c (patch)
treef7013324102eb69bd09a3f9736c428773e05462f /test
parentb5c70814e5449bc2a748cc96056eb9ed7255fded (diff)
downloadbun-f6bbfb16fd011bc3d24c9fb29032bebb9b2fae0c.tar.gz
bun-f6bbfb16fd011bc3d24c9fb29032bebb9b2fae0c.tar.zst
bun-f6bbfb16fd011bc3d24c9fb29032bebb9b2fae0c.zip
Add a couple tests
Diffstat (limited to 'test')
-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 */ `