11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// This tests that module.runMain can be monkey patched using --require. 41cb0ef41Sopenharmony_ci// TODO(joyeecheung): This probably should be deprecated. 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_cirequire('../common'); 71cb0ef41Sopenharmony_ciconst { path } = require('../common/fixtures'); 81cb0ef41Sopenharmony_ciconst assert = require('assert'); 91cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst child = spawnSync(process.execPath, [ 121cb0ef41Sopenharmony_ci '--require', 131cb0ef41Sopenharmony_ci path('monkey-patch-run-main.js'), 141cb0ef41Sopenharmony_ci path('semicolon.js'), 151cb0ef41Sopenharmony_ci]); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ciassert.strictEqual(child.status, 0); 181cb0ef41Sopenharmony_ciassert(child.stdout.toString().includes('runMain is monkey patched!')); 19