Files
node/test/es-module/test-esm-package-map-version-fork.mjs
T
Maël Nison 2f2b81095b loader: implement package maps
Signed-off-by: Mael Nison <nison.mael@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62239
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-06-12 16:02:01 +00:00

20 lines
746 B
JavaScript

// Test that the same bare specifier resolves to different packages depending on the importer.
import '../common/index.mjs';
import assert from 'node:assert';
import { spawnSyncAndAssert } from '../common/child_process.js';
import * as fixtures from '../common/fixtures.mjs';
spawnSyncAndAssert(process.execPath, [
'--no-warnings',
'--experimental-package-map',
fixtures.path('package-map/package-map-version-fork.json'),
'--input-type=module',
'--eval',
`import app18 from 'app-18'; import app19 from 'app-19'; console.log(app18); console.log(app19);`,
], { cwd: fixtures.path('package-map/root') }, {
stdout(output) {
assert.match(output, /app-18 using react 18/);
assert.match(output, /app-19 using react 19/);
},
});