node/test/parallel/test-module-run-main-monkey-patch.js
Antoine du Hamel 0457bfee2c
test: forbid use of named imports for fixtures
PR-URL: https://github.com/nodejs/node/pull/61228
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-01-01 23:48:26 +00:00

18 lines
551 B
JavaScript

'use strict';
// This tests that module.runMain can be monkey patched using --require.
// TODO(joyeecheung): This probably should be deprecated.
require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
const { spawnSync } = require('child_process');
const child = spawnSync(process.execPath, [
'--require',
fixtures.path('monkey-patch-run-main.js'),
fixtures.path('semicolon.js'),
]);
assert.strictEqual(child.status, 0);
assert(child.stdout.toString().includes('runMain is monkey patched!'));