• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2// This test checks the usage of --use-bundled-ca and --use-openssl-ca arguments
3// to verify that both are not used at the same time.
4const common = require('../common');
5if (!common.hasCrypto)
6  common.skip('missing crypto');
7
8const assert = require('assert');
9const os = require('os');
10const childProcess = require('child_process');
11const result = childProcess.spawnSync(
12  process.execPath,
13  [ '--use-bundled-ca', '--use-openssl-ca', '-p', 'process.version' ],
14  { encoding: 'utf8' }
15);
16
17assert.strictEqual(result.stderr, `${process.execPath
18}: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}`
19);
20assert.strictEqual(result.status, 9);
21
22const useBundledCA = childProcess.spawnSync(process.execPath, [
23  '--use-bundled-ca',
24  '-p', 'process.version']);
25assert.strictEqual(useBundledCA.status, 0);
26
27const useOpenSSLCA = childProcess.spawnSync(process.execPath, [
28  '--use-openssl-ca',
29  '-p', 'process.version']);
30assert.strictEqual(useOpenSSLCA.status, 0);
31