From f6bbfb16fd011bc3d24c9fb29032bebb9b2fae0c Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Fri, 12 May 2023 07:27:03 -0700 Subject: Add a couple tests --- test/bundler/bundler_cjs2esm.test.ts | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'test') 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 */ ` -- cgit v1.2.3