summaryrefslogtreecommitdiff
path: root/test/parallel/test-module-run-main-monkey-patch.js
blob: c9f189abb688218dda9d64ae452911b011983578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';

// This tests that module.runMain can be monkey patched using --require.
// TODO(joyeecheung): This probably should be deprecated.

require('../common');
const { path } = require('../common/fixtures');
const assert = require('assert');
const { spawnSync } = require('child_process');

const child = spawnSync(process.execPath, [
  '--require',
  path('monkey-patch-run-main.js'),
  path('semicolon.js'),
]);

assert.strictEqual(child.status, 0);
assert(child.stdout.toString().includes('runMain is monkey patched!'));