Skip to content

feat: list relevant audits on category failure #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2020

Conversation

erezrokah
Copy link
Contributor

@erezrokah erezrokah commented Jul 21, 2020

Fixes https://github.com/netlify-labs/netlify-plugin-lighthouse/issues/46

Prints a detailed version with specific audits to the log, and report a short version (only categories) to be shown in the UI summary.

Build log:
https://app.netlify.com/sites/plugin-lighthouse/deploys/5f184ada44438d0008132480

@erezrokah erezrokah force-pushed the feat/report_failed_audits branch from 34c336e to 2104248 Compare July 21, 2020 21:22
@erezrokah erezrokah marked this pull request as draft July 22, 2020 12:23
@erezrokah
Copy link
Contributor Author

@ehmicky, thanks I'm still improving it (the build summary with the error is too verbose. I would like it to only show the failed categories and the specific audits should show up in the logs).

@erezrokah erezrokah requested a review from ehmicky July 22, 2020 12:54
@ehmicky ehmicky requested review from ehmicky and removed request for ehmicky July 22, 2020 13:19
@erezrokah erezrokah force-pushed the feat/report_failed_audits branch from 36d4360 to bbc3bee Compare July 22, 2020 14:22
category.title,
)} to be greater or equal to ${chalk.green(expected)} but got ${chalk.red(
category.score !== null ? category.score : 'unknown',
)}`;

const categoryAudits = category.auditRefs
.filter(({ weight, id }) => weight > 0 && audits[id].score < 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only list audits that donated to the category score based on weight, and also ignore audits with a perfect score

@@ -126,34 +141,53 @@ const runAudit = async ({ path, url, thresholds }) => {
return {
summary,
shortSummary,
error: errors.length > 0 ? new Error(`\n${errors.join('\n')}`) : false,
errors,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't format the message here so we can create both a short message and a detailed message later on.

@erezrokah erezrokah force-pushed the feat/report_failed_audits branch from bbc3bee to 0e0ce82 Compare July 22, 2020 14:38
failBuild(chalk.red('Failed with error:\n'), { error });
if (error.details) {
console.error(error.details);
failBuild(`${chalk.red('Failed with error:\n')}${error.message}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the internal stack trace in this case.

@erezrokah erezrokah marked this pull request as ready for review July 22, 2020 14:39
@erezrokah
Copy link
Contributor Author

erezrokah commented Jul 22, 2020

@ehmicky this is ready (I updated the deploy log and PR description)

@erezrokah erezrokah merged commit 6b9a854 into master Jul 22, 2020
@erezrokah erezrokah deleted the feat/report_failed_audits branch July 22, 2020 15:56
erezrokah added a commit that referenced this pull request Jul 22, 2020
# [1.4.0](v1.3.2...v1.4.0) (2020-07-22)

### Bug Fixes

* **deps:** update dependency puppeteer to v5.2.1 ([#54](#54)) ([176049b](176049b))

### Features

* list relevant audits on category failure ([#56](#56)) ([6b9a854](6b9a854))
@erezrokah
Copy link
Contributor Author

🎉 This PR is included in version 1.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do I see a list of audits failing during a build?
2 participants