-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Adds support for custom audits and gatherers #593
Conversation
return definition; | ||
} | ||
|
||
const requirePath = auditPath.startsWith('/') ? auditPath : path.join(rootPath, auditPath); |
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 think there's a path.resolve() or something to sort out absolute vs not. Would rather that then us handling the branch.
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 will be great to have (and love the audit validation :). Two more thoughts:
The config would then look something like: {
"audits": [
"is-on-https",
"redirects-http",
"service-worker",
"path/to/my/audits/audit1/cool-audit",
"audit-security-mixedcontent/audits/better-audit"
]
} (similar for gatherers) This would also support a more straightforward include process, basically
This lets It also sometimes eliminates the need for paths in the config file. If they are npm modules or are put in a directory {
"audits": [
"is-on-https",
"redirects-http",
"service-worker",
"cool-audit",
"better-audit"
]
} |
Okay, hopefully I've struck the right balance here:
PTAL |
return Promise.reject(new Error('You must provide a config')); | ||
} | ||
|
||
// Default mobile emulation and page loading to true. |
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 set of checks duplicates what's already in runner. : https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/runner.js#L29-L44
I think we should only check where neccessary and not end up with all the duplication. If we can't keep straight if we need a safety check, then we probably need to untangle a bit. (I'm thinking of our refactor for traceEvents
a bit ago. There's a few more in the wings.)
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 agree. This looks like an artifact of my refactoring perhaps, rather than something that should be there.
lgtm |
I do think we should get @ebidel @hsablonniere or @blaine to bang around with this API to make sure this works well. |
Agreed. I'm very open to this changing with developer feedback. My feeling is we should merge, and then revisit it once folks can have a play with it and let us know how well it works for them. |
I won't be able to play with it over the weekend. Maybe next week. This definitely seems interesting. |
K merging so it's available. @paullewis let's get some notes in the readme on how to use it. |
Been waiting for this to merge so I can give feedback. Too early to tell On Fri, Aug 19, 2016, 6:55 PM Paul Irish [email protected] wrote:
|
This PR allows us to specify additional paths for audits and gatherers in the config, which get searched when we do the requires.
The properties in the config are thus:
A custom gatherer looks like this:
and a custom audit like this:
Then if you fancy it you can just adjust the reporting to suit.