• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const assert = require('assert');
5const { exec } = require('child_process');
6
7const node = process.execPath;
8
9// Should throw if -c and -e flags are both passed
10['-c', '--check'].forEach(function(checkFlag) {
11  ['-e', '--eval'].forEach(function(evalFlag) {
12    const args = [checkFlag, evalFlag, 'foo'];
13    const cmd = [node, ...args].join(' ');
14    exec(cmd, common.mustCall((err, stdout, stderr) => {
15      assert.strictEqual(err instanceof Error, true);
16      assert.strictEqual(err.code, 9);
17      assert(
18        stderr.startsWith(
19          `${node}: either --check or --eval can be used, not both`
20        )
21      );
22    }));
23  });
24});
25