(options: LighthouseCliOptions)
| 84 | } |
| 85 | |
| 86 | export function runnerConfig(options: LighthouseCliOptions): RunnerConfig { |
| 87 | const { |
| 88 | outputPath = LIGHTHOUSE_OUTPUT_FILE_DEFAULT, |
| 89 | userDataDir, |
| 90 | ...remnainingOptions |
| 91 | } = options; |
| 92 | |
| 93 | // eslint-disable-next-line functional/no-let |
| 94 | let lhCliOpts: LighthouseCliOptions = { |
| 95 | ...remnainingOptions, |
| 96 | outputPath, |
| 97 | }; |
| 98 | if (userDataDir !== undefined) { |
| 99 | lhCliOpts = { ...lhCliOpts, userDataDir }; |
| 100 | } |
| 101 | |
| 102 | return { |
| 103 | command: 'npx', |
| 104 | args: getLighthouseCliArguments(lhCliOpts), |
| 105 | outputFile: outputPath, |
| 106 | outputTransform: (lighthouseOutput: unknown) => |
| 107 | lhrToAuditOutputs(lighthouseOutput as Result), |
| 108 | }; |
| 109 | } |
| 110 | |
| 111 | function lhrToAuditOutputs(lhr: Result): AuditOutputs { |
| 112 | return Object.values(lhr.audits).map( |
no test coverage detected