test(compartment-mapper): Failing test for CommonJS namespace exports
MODIFY
packages/compartment-mapper/test/fixtures-0/node_modules/app/main.js
packages/compartment-mapper/test/fixtures-0/node_modules/app/main.js
/* global globalProperty, globalLexical */
+import 'esmcjs';
+
import typemodule from 'typemodule';
import typecommon from 'typecommon';
import typeparsers from 'typeparsers';

MODIFY
packages/compartment-mapper/test/fixtures-0/node_modules/app/package.json
packages/compartment-mapper/test/fixtures-0/node_modules/app/package.json
"avery": "^1.0.0",
"brooke": "^1.0.0",
"clarke": "^1.0.0",
- "danny": "^1.0.0"
+ "danny": "^1.0.0",
+ "esmcjs": "^1.0.0"
},
"devDependencies": {
"typecommon": "^1.0.0",

ADD
packages/compartment-mapper/test/fixtures-0/node_modules/esmcjs/index.mjs
+import defaultAsName from './module-exports-assigned-object.cjs';
+import * as namespaceAsName from './module-exports-assigned-object.cjs';
+// import { name } from './module-exports-assigned-object.cjs'; // Not expected to work, does not work on Node.js
+if (defaultAsName.name !== 42) {
+ throw new Error(`Assigning to module exports should be equivalent to exporting a default`);
+}
+if (namespaceAsName.default.name !== 42) {
+ throw new Error(`Assigning to module exports should be equivalent to exporting a default on the namespace object`);
+}
+if (namespaceAsName.name !== undefined) {
+ throw new Error(`Assigning to module exports should not replace the properties of the namespace object`);
+}

ADD
packages/compartment-mapper/test/fixtures-0/node_modules/esmcjs/module-exports-assigned-object.cjs
+module.exports = {
+ name: 42,
+};

ADD
packages/compartment-mapper/test/fixtures-0/node_modules/esmcjs/package.json
+{
+ "name": "esmcjs",
+ "main": "./index.mjs"
+}

test(compartment-mapper): Failing test for CommonJS namespace exports