11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst { execFileSync } = require('child_process'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst entryPoints = ['iDoNotExist', 'iDoNotExist.js', 'iDoNotExist.mjs']; 71cb0ef41Sopenharmony_ciconst node = process.argv[0]; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_cifor (const entryPoint of entryPoints) { 101cb0ef41Sopenharmony_ci try { 111cb0ef41Sopenharmony_ci execFileSync(node, [entryPoint], { stdio: 'pipe' }); 121cb0ef41Sopenharmony_ci } catch (e) { 131cb0ef41Sopenharmony_ci const error = e.toString(); 141cb0ef41Sopenharmony_ci assert.match(error, /MODULE_NOT_FOUND/); 151cb0ef41Sopenharmony_ci assert.match(error, /Cannot find module/); 161cb0ef41Sopenharmony_ci assert(error.includes(entryPoint)); 171cb0ef41Sopenharmony_ci continue; 181cb0ef41Sopenharmony_ci } 191cb0ef41Sopenharmony_ci assert.fail('Executing node with inexistent entry point should ' + 201cb0ef41Sopenharmony_ci `fail. Entry point: ${entryPoint}`); 211cb0ef41Sopenharmony_ci} 22