Open armancodv opened 1 year ago
I had this same problem, I had
config: {
output: 'html'
}
in my cypress.config.js and when I changed config
key to options
, it started to work.
options: {
output: 'html'
}
I'm also having this same issue as well. I tried even passing the args for lighthouse for the output and no luck.
RESOLVED
This PR, #221 , has made updates to the documentation for report generation. To implement the changes, please use the code snippet provided below:
const thresholds = {
/* ... */
};
const lighthouseOptions = {
/* ... your lighthouse options */
};
const lighthouseConfig = {
settings: { output: "html" },
extends: "lighthouse:default",
/* ... Alternatively, you could set your own lighthouse config */
};
cy.lighthouse(thresholds, lighthouseOptions, lighthouseConfig);
Link to updated Doc: https://github.com/mfrachet/cypress-audit/blob/master/packages/documentation/docs/guides/lighthouse/reports.md
I suggest updating this page as well: https://mfrachet.github.io/cypress-audit/guides/lighthouse/reports.html#generating-html-reports
PS: I can confirm @hernikplays 's solution also works.
If I would only check the issues section sooner. Just wasted a couple of days trying to figure out what I'm doing wrong. This fixed it for me
const lighthouseConfig = { settings: { output: "html" }, extends: "lighthouse:default",
I also like to add that I also had to replace (error : any)
with (error)
in fs.writeFile("lighthouse.html", lighthouseReport.report, (error) => {
What does not work? When you run cy.lighthouse() everything works but no HTML or JSON report generates. But as soon as I add config
config: { output: 'html' }
(as third arguments or in cypress config) The test fails and throws:Hints:
How to reproduce?
cypress.config.js -> update on('task')
OR home.cy.js -> update cy.lighthouse
Environment: