summaryrefslogtreecommitdiff
path: root/test/parallel/test-module-run-main-monkey-patch.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-module-run-main-monkey-patch.js')
-rw-r--r--test/parallel/test-module-run-main-monkey-patch.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/parallel/test-module-run-main-monkey-patch.js b/test/parallel/test-module-run-main-monkey-patch.js
new file mode 100644
index 0000000000..c9f189abb6
--- /dev/null
+++ b/test/parallel/test-module-run-main-monkey-patch.js
@@ -0,0 +1,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!'));