@@ -104,6 +104,13 @@ const formatResults = ({ results, thresholds }) => {
104
104
105
105
const formattedReport = makeReplacements ( results . report ) ;
106
106
107
+ // Pull some additional details to pass to App
108
+ const { formFactor, locale } = results . lhr . configSettings ;
109
+ const installable =
110
+ results . lhr . audits [ 'installable-manifest' ] . score === 1 &&
111
+ results . lhr . audits [ 'service-worker' ] . score === 1 ;
112
+ const details = { installable, formFactor, locale } ;
113
+
107
114
const report = minify ( formattedReport , {
108
115
removeAttributeQuotes : true ,
109
116
collapseWhitespace : true ,
@@ -114,7 +121,7 @@ const formatResults = ({ results, thresholds }) => {
114
121
minifyJS : true ,
115
122
} ) ;
116
123
117
- return { summary, shortSummary, report, errors } ;
124
+ return { summary, shortSummary, details , report, errors } ;
118
125
} ;
119
126
120
127
const persistResults = async ( { report, path } ) => {
@@ -161,7 +168,7 @@ const runAudit = async ({ path, url, thresholds, output_path, settings }) => {
161
168
if ( error ) {
162
169
return { error } ;
163
170
} else {
164
- const { summary, shortSummary, report, errors } = formatResults ( {
171
+ const { summary, shortSummary, details , report, errors } = formatResults ( {
165
172
results,
166
173
thresholds,
167
174
} ) ;
@@ -173,6 +180,7 @@ const runAudit = async ({ path, url, thresholds, output_path, settings }) => {
173
180
return {
174
181
summary,
175
182
shortSummary,
183
+ details,
176
184
report,
177
185
errors,
178
186
} ;
@@ -226,8 +234,8 @@ const processResults = ({ data, errors }) => {
226
234
const reports = [ ] ;
227
235
return {
228
236
summary : data
229
- . map ( ( { path, url, summary, shortSummary, report } ) => {
230
- const obj = { report } ;
237
+ . map ( ( { path, url, summary, shortSummary, details , report } ) => {
238
+ const obj = { report, details } ;
231
239
232
240
if ( summary ) {
233
241
obj . summary = summary . reduce ( ( acc , item ) => {
@@ -271,13 +279,14 @@ module.exports = {
271
279
const allErrors = [ ] ;
272
280
const data = [ ] ;
273
281
for ( const { path, url, thresholds, output_path } of audits ) {
274
- const { errors, summary, shortSummary, report } = await runAudit ( {
275
- path,
276
- url,
277
- thresholds,
278
- output_path,
279
- settings,
280
- } ) ;
282
+ const { errors, summary, shortSummary, details, report } =
283
+ await runAudit ( {
284
+ path,
285
+ url,
286
+ thresholds,
287
+ output_path,
288
+ settings,
289
+ } ) ;
281
290
if ( summary ) {
282
291
console . log ( { results : summary } ) ;
283
292
}
@@ -299,6 +308,7 @@ module.exports = {
299
308
url,
300
309
summary,
301
310
shortSummary,
311
+ details,
302
312
report,
303
313
} ) ;
304
314
}
0 commit comments