test(compartment-mapper): Add reflexive import tests
ADD
packages/compartment-mapper/test/fixtures-cycle-cjs/node_modules/app/index.js
+require('app');

ADD
packages/compartment-mapper/test/fixtures-cycle-cjs/node_modules/app/package.json
+{
+ "name": "app",
+ "type": "commonjs"
+}

ADD
packages/compartment-mapper/test/fixtures-cycle-mjs/node_modules/app/index.js
+import 'app';

ADD
packages/compartment-mapper/test/fixtures-cycle-mjs/node_modules/app/package.json
+{
+ "name": "app",
+ "type": "module"
+}

ADD
packages/compartment-mapper/test/test-cycle-cjs.js
+// import "./ses-lockdown.js";
+import 'ses';
+import fs from 'fs';
+import test from 'ava';
+import { loadLocation } from '../src/import.js';
+import { makeNodeReadPowers } from '../src/node-powers.js';
+
+const readPowers = makeNodeReadPowers(fs);
+const { read } = readPowers;
+
+test('reflexive CommonJS cyclic import', async t => {
+ t.plan(1);
+
+ const fixture = new URL(
+ 'fixtures-cycle-cjs/node_modules/app/index.js',
+ import.meta.url,
+ ).toString();
+
+ const application = await loadLocation(read, fixture);
+ await application.import({});
+ t.pass();
+});

ADD
packages/compartment-mapper/test/test-cycle-mjs.js
+// import "./ses-lockdown.js";
+import 'ses';
+import fs from 'fs';
+import test from 'ava';
+import { loadLocation } from '../src/import.js';
+import { makeNodeReadPowers } from '../src/node-powers.js';
+
+const readPowers = makeNodeReadPowers(fs);
+const { read } = readPowers;
+
+test('reflexive cycle of ESM', async t => {
+ t.plan(1);
+
+ const fixture = new URL(
+ 'fixtures-cycle-mjs/node_modules/app/index.js',
+ import.meta.url,
+ ).toString();
+
+ const application = await loadLocation(read, fixture);
+ await application.import({});
+ t.pass();
+});

test(compartment-mapper): Add reflexive import tests