Skip to content

Commit

Permalink
Run audits sequentially.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Aug 10, 2016
1 parent 703ded6 commit 8fe81d8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lighthouse-core/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ class Runner {
}

// Now run the audits.
run = run.then(artifacts => Promise.all(config.audits.map(audit => {
let auditResults = [];
run = run.then(artifacts => config.audits.reduce((chain, audit) => {
const status = `Evaluating: ${audit.meta.description}`;
log.log('status', status);
return Promise.resolve(audit.audit(artifacts)).then(ret => {
// Run each audit sequentially, the auditResults array has all our fine work
return chain.then(_ => {
log.log('status', status);
return audit.audit(artifacts);
}).then(ret => {
log.verbose('statusEnd', status);
return ret;
auditResults.push(ret);
});
})));
}, Promise.resolve()).then(_ => auditResults));
} else if (config.auditResults) {
// If there are existing audit results, surface those here.
run = run.then(_ => config.auditResults);
Expand Down

0 comments on commit 8fe81d8

Please sign in to comment.