function finalizeArtifacts(baseArtifacts, gathererArtifacts) {
  baseArtifacts.LighthouseRunWarnings.push(
    ...getEnvironmentWarnings({settings: baseArtifacts.settings, baseArtifacts})
  );

  // Cast to remove the partial from gathererArtifacts.
  const artifacts = /** @type {LH.Artifacts} */ ({...baseArtifacts, ...gathererArtifacts});

  // Set the post-run meta artifacts.
  artifacts.Timing = log.getTimeEntries();
  artifacts.LighthouseRunWarnings = deduplicateWarnings(baseArtifacts.LighthouseRunWarnings);

  if (artifacts.PageLoadError && !artifacts.URL.finalDisplayedUrl) {
    artifacts.URL.finalDisplayedUrl = artifacts.URL.requestedUrl || '';
  }

  // Check that the runner remembered to mutate the special-case URL artifact.
  if (!artifacts.URL.finalDisplayedUrl) throw new Error('Runner did not set finalDisplayedUrl');

  return artifacts;
}
@param {LH.BaseArtifacts} baseArtifacts
@param {Partial<LH.GathererArtifacts>} gathererArtifacts
@return {LH.Artifacts}