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 flags = [[], ['--preserve-symlinks']]; 81cb0ef41Sopenharmony_ciconst node = process.argv[0]; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cifor (const args of flags) { 111cb0ef41Sopenharmony_ci for (const entryPoint of entryPoints) { 121cb0ef41Sopenharmony_ci try { 131cb0ef41Sopenharmony_ci execFileSync(node, args.concat(entryPoint)); 141cb0ef41Sopenharmony_ci } catch (e) { 151cb0ef41Sopenharmony_ci assert(e.toString().match(/Error: Cannot find module/)); 161cb0ef41Sopenharmony_ci continue; 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci assert.fail('Executing node with inexistent entry point should ' + 191cb0ef41Sopenharmony_ci `fail. Entry point: ${entryPoint}, Flags: [${args}]`); 201cb0ef41Sopenharmony_ci } 211cb0ef41Sopenharmony_ci} 22