loadPkgRc = (args = {}) => {
  let result;
  if (args.package === false) {
    return result;
  }
  result = {};
  const filepath = args.package || findUp.sync(mocharc.package);
  if (filepath) {
    let configData;
    try {
      configData = fs.readFileSync(filepath, 'utf8');
    } catch (err) {
      // If `args.package` was explicitly specified, throw an error
      if (filepath == args.package) {
        throw createUnparsableFileError(
          `Unable to read ${filepath}: ${err}`,
          filepath
        );
      } else {
        debug('failed to read default package.json at %s; ignoring',
              filepath);
        return result;
      }
    }
    try {
      const pkg = JSON.parse(configData);
      if (pkg.mocha) {
        debug('`mocha` prop of package.json parsed: %O', pkg.mocha);
        result = pkg.mocha;
      } else {
        debug('no config found in %s', filepath);
      }
    } catch (err) {
      // If JSON failed to parse, throw an error.
      throw createUnparsableFileError(
        `Unable to parse ${filepath}: ${err}`,
        filepath
      );
    }
  }
  return result;
}
Given path to `package.json` in `args.package`, attempt to load config from `mocha` prop.
@param {Object} [args] - Arguments object
@param {string|boolean} [args.config] - Path to `package.json` or `false` to skip
@public
@alias module:lib/cli.loadPkgRc
@returns {external:yargsParser.Arguments|void} Parsed config, or nothing if `args.package` is `false`