async function loadExternalConfig({ errorComposer, configPath, cwd }) {
  const resolvedConfigPath = await resolveConfigPath(configPath, cwd);

  if (resolvedConfigPath) {
    errorComposer.setDetoxConfigPath(resolvedConfigPath);

    let result;
    try {
      result = await loadConfig(resolvedConfigPath);
    } catch (e) {
      throw errorComposer.failedToReadConfiguration(e);
    }

    result.config = await tryExtendConfig({
      config: result.config,
      cwd: path.dirname(resolvedConfigPath),
      errorComposer,
    });

    return result;
  } else if (configPath) {
    throw errorComposer.noConfigurationAtGivenPath(configPath);
  }

  return null;
}
@param {DetoxConfigErrorComposer} errorComposer
@param {string} configPath
@param {string} cwd
@returns {Promise<null|{filepath: *, config: any}>}