All files / lib/internal options.js

100% Statements 32/32
100% Branches 5/5
100% Functions 2/2
100% Lines 32/32

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33137x 137x 137x 137x 137x 137x 137x 264054x 264054x 264054x 137x 1400x 1400x 1400x 1400x 3x 3x 3x 3x 3x 3x 3x 1400x 1400x 137x 137x 137x 137x 137x 137x 137x 137x  
'use strict';
 
const { getOptions, shouldNotRegisterESMLoader } = internalBinding('options');
const { options, aliases } = getOptions();
 
let warnOnAllowUnauthorized = true;
 
function getOptionValue(option) {
  return options.get(option)?.value;
}
 
function getAllowUnauthorized() {
  const allowUnauthorized = process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0';
 
  if (allowUnauthorized && warnOnAllowUnauthorized) {
    warnOnAllowUnauthorized = false;
    process.emitWarning(
      'Setting the NODE_TLS_REJECT_UNAUTHORIZED ' +
      'environment variable to \'0\' makes TLS connections ' +
      'and HTTPS requests insecure by disabling ' +
      'certificate verification.');
  }
  return allowUnauthorized;
}
 
module.exports = {
  options,
  aliases,
  getOptionValue,
  getAllowUnauthorized,
  shouldNotRegisterESMLoader
};