function composeArtifactsConfig({
  cliConfig,
  configurationName,
  localConfig,
  globalConfig,
}) {
  const artifactsConfig = _.defaultsDeep(
    extendArtifactsConfig({
      rootDir: cliConfig.artifactsLocation,
      plugins: {
        log: cliConfig.recordLogs,
        screenshot: cliConfig.takeScreenshots,
        video: cliConfig.recordVideos,
        instruments: cliConfig.recordPerformance,
        uiHierarchy: cliConfig.captureViewHierarchy,
      },
    }),
    extendArtifactsConfig(localConfig.artifacts),
    extendArtifactsConfig(globalConfig.artifacts),
    extendArtifactsConfig(false),
  );

  if (!artifactsConfig.pathBuilder) {
    artifactsConfig.pathBuilder = undefined;
  }

  artifactsConfig.rootDir = buildDefaultArtifactsRootDirpath(
    configurationName,
    artifactsConfig.rootDir
  );

  return artifactsConfig;
}
@param {*} cliConfig
@param {string} configurationName
@param {Detox.DetoxConfig} globalConfig
@param {Detox.DetoxConfiguration} localConfig