-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
report: show axe version in runtime settings #10729
Conversation
I thought we were talking in runtime settings? |
I also thought we decided on runtime settings, but I kinda like this too. I'm up for either if we can reach a quick consensus? |
sorry, I have conflated these two parts of the report, you're right the consensus was on runtime settings ... I do think like it better in the footer though :) |
I mean the footer isn't the credits, it's telling the user what the thing they just read was (more or less a colophon). We consider the host UA part of the testing environment in the same way as axe would be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was marked as waiting on me, so I gave a review, but I'm a little unclear as to what's been decided re: runtime settings vs. footer.
I see arguments for both:
Runtime Settings
Mostly what @brendankenny said. The footer isn't meant to be an all-encompassing credits and I'm not sure the axe version is critical enough to the entire report to be included there.
Footer
Runtime settings are mostly things that change from run to run and are under the influence of the runner whereas the axe version is just derived from the Lighthouse version and isn't really specific to the run we saw.
Anyone wanna concede? :)
lighthouse-core/runner.js
Outdated
// fallback to package json so the report will always have some version. | ||
const axeVersion = artifacts.Accessibility ? | ||
artifacts.Accessibility.version : | ||
require('../package.json').dependencies['axe-core']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's combine this import of package.json
with the one for lhVersion rather than require twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe package-json-versionify
is going to strip out dependencies
and make this a cannot read property 'axe-core' of undefined
. We could drop that and just live with all of package.json
in our bundle, but that is kind of unfortunate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package-json-versionify
I had no idea that existed :) bummer too because there's no way that would've been caught either, smoke test of the bundle without running a11y?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the error case @brendankenny points out of axe failing probably means we'll need the fallback even when we do run axe, maybe we should just always state this version?
lighthouse-core/runner.js
Outdated
@@ -131,6 +137,7 @@ class Runner { | |||
benchmarkIndex: artifacts.BenchmarkIndex, | |||
}, | |||
lighthouseVersion, | |||
axeVersion, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this belong in environment
instead of the toplevel? I guess it might depend on our resolution to runtimesettings v. footer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this belong in
environment
instead of the toplevel? I guess it might depend on our resolution to runtimesettings v. footer?
+1 to moving to environment
regardless. Not even axe puts the axe version number at the top level of their results object :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. but how about a toplevel credits
object though? or environment.credits
?
types/lhr.d.ts
Outdated
@@ -41,6 +41,8 @@ declare global { | |||
fetchTime: string; | |||
/** The version of Lighthouse with which these results were generated. */ | |||
lighthouseVersion: string; | |||
/** The version of Axe with which these results were generated. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** The version of Axe with which these results were generated. */ | |
/** The version of axe-core with which these results were generated. */ |
That's true, but that's partly just because we called it "runtime settings" and not the broader "environment" as it's named in the LHR :) If we ever switch to puppeteer as our chrome launcher and have a 1:1 Lighthouse version to Chrome version we probably still won't remove it from there. |
lighthouse-core/runner.js
Outdated
// fallback to package json so the report will always have some version. | ||
const axeVersion = artifacts.Accessibility ? | ||
artifacts.Accessibility.version : | ||
require('../package.json').dependencies['axe-core']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe package-json-versionify
is going to strip out dependencies
and make this a cannot read property 'axe-core' of undefined
. We could drop that and just live with all of package.json
in our bundle, but that is kind of unfortunate.
lighthouse-core/runner.js
Outdated
// Use version from gathering stage. In case accessibility category doesn't run, | ||
// fallback to package json so the report will always have some version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really care about including info on a library when we didn't run it? The larger question is probably should we be generalizing this to the equivalent of chrome://credits/
for all our libraries in the lhr but then selectively show in the report, but I also don't feel strongly.
lighthouse-core/runner.js
Outdated
@@ -107,6 +107,12 @@ class Runner { | |||
// Entering: conclusion of the lighthouse result object | |||
const lighthouseVersion = require('../package.json').version; | |||
|
|||
// Use version from gathering stage. In case accessibility category doesn't run, | |||
// fallback to package json so the report will always have some version. | |||
const axeVersion = artifacts.Accessibility ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other failure mode is when artifacts.Accessibility
exists but is an Error
object because something threw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just not show in runtime settings if we didn't find a version in the artifact
Resolution from last group discussion: we'll add to Runtime settings as ~"axe-core version" two additional things
|
FYI @connorjclark it looks like we settled discussion on this and decided to proceed in runtime settings. I'll flip this to waiting for committer status accordingly, but no rush. |
types/lhr.d.ts
Outdated
@@ -41,6 +41,8 @@ declare global { | |||
fetchTime: string; | |||
/** The version of Lighthouse with which these results were generated. */ | |||
lighthouseVersion: string; | |||
/** The version of libraries with which these results were generated. Ex: axe-core. */ | |||
credits: Record<string, string>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a new toplevel property for this still makes me cringe a little, do we really foresee ever surfacing anything else here?
I'm still in camp environment.axeVersion
ducks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even after my suggestion of environment.credits
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.environment.credits
preferred to .credits
for sure :)
I'm just hesitant on credits without any clue what would go into here that doesn't encourage us to start listing every dependency. is there any particular future lib you had in mind we might one day want to put into here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking anything that informs the results of the report (so not, for example, lodash):
js-library-detector
third-party-web
robots-parser
(not exhaustive)
Not suggesting we show all in runtime settings. Would need different UI I think for more than one version. axe is the largest so am ok just showing that in runtime setting for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
third-party-web
I see what you did there ;) I'm sold 👍 🤣 😆
].forEach(runtime => { | ||
if (!runtime.description) return; | ||
]; | ||
if (report.environment.credits && report.environment.credits['axe-core']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this how to properly maintain backwards compat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Brendan Kenny <bckenny@gmail.com>
fixes #10640