1'use strict'; 2require('../common'); 3const assert = require('assert'); 4const { execFileSync } = require('child_process'); 5 6const entryPoints = ['iDoNotExist', 'iDoNotExist.js', 'iDoNotExist.mjs']; 7const node = process.argv[0]; 8 9for (const entryPoint of entryPoints) { 10 try { 11 execFileSync(node, [entryPoint], { stdio: 'pipe' }); 12 } catch (e) { 13 const error = e.toString(); 14 assert.match(error, /MODULE_NOT_FOUND/); 15 assert.match(error, /Cannot find module/); 16 assert(error.includes(entryPoint)); 17 continue; 18 } 19 assert.fail('Executing node with inexistent entry point should ' + 20 `fail. Entry point: ${entryPoint}`); 21} 22