Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static finalizeBaseArtifacts(baseArtifacts) {
// Take only unique LighthouseRunWarnings.
baseArtifacts.LighthouseRunWarnings = Array.from(new Set(baseArtifacts.LighthouseRunWarnings));
// Take the timing entries we've gathered so far.
baseArtifacts.Timing = log.getTimeEntries();
}
gathererArtifacts[gathererName] = /** @type {NonVoid} */ (artifact);
} catch (err) {
// Return error to runner to handle turning it into an error audit.
gathererArtifacts[gathererName] = err;
}
if (gathererArtifacts[gathererName] === undefined) {
throw new Error(`${gathererName} failed to provide an artifact.`);
}
}
// Take only unique LighthouseRunWarnings.
baseArtifacts.LighthouseRunWarnings = Array.from(new Set(baseArtifacts.LighthouseRunWarnings));
// Take the timing entries we've gathered so far.
baseArtifacts.Timing = log.getTimeEntries();
// TODO(bckenny): correct Partial at this point to drop cast.
return /** @type {LH.Artifacts} */ ({...baseArtifacts, ...gathererArtifacts});
}