mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
PR-URL: https://github.com/nodejs/node/pull/60891 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
37 lines
930 B
JavaScript
37 lines
930 B
JavaScript
'use strict';
|
|
|
|
// This tests that the require(esm) works from an imported CJS module
|
|
// when the require-d ESM is cached separately.
|
|
|
|
require('../common');
|
|
const { spawnSyncAndAssert } = require('../common/child_process');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
[
|
|
'--experimental-require-module',
|
|
'--import',
|
|
fixtures.fileURL('es-modules', 'require-esm-in-cjs-cache', 'instrument-sync.js'),
|
|
fixtures.path('es-modules', 'require-esm-in-cjs-cache', 'app.cjs'),
|
|
],
|
|
{
|
|
trim: true,
|
|
stdout: / default: { hello: 'world' }/,
|
|
}
|
|
);
|
|
|
|
spawnSyncAndAssert(
|
|
process.execPath,
|
|
[
|
|
'--experimental-require-module',
|
|
'--import',
|
|
fixtures.fileURL('es-modules', 'require-esm-in-cjs-cache', 'instrument.js'),
|
|
fixtures.path('es-modules', 'require-esm-in-cjs-cache', 'app.cjs'),
|
|
],
|
|
{
|
|
trim: true,
|
|
stdout: / default: { hello: 'world' }/,
|
|
}
|
|
);
|