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