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 33135x 135x 135x 135x 135x 135x 135x 267691x 267691x 267691x 135x 1402x 1402x 1402x 1402x 3x 3x 3x 3x 3x 3x 3x 1402x 1402x 135x 135x 135x 135x 135x 135x 135x 135x  
'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
};