-
Notifications
You must be signed in to change notification settings - Fork 127
Conversation
Ops! I just see the How can we get the report url? |
The build server returns the report results here: https://github.com/ebidel/lighthouse-ci/blob/6303c79cfed38e64cd68b9e472bfedfbba3960cf/builder/server.js#L24 You'd probabably have to change the response of https://github.com/ebidel/lighthouse-ci/blob/e7772404d23d25482379fe3f21dee54f599350d8/frontend/server.js#L170 to return more than just the report. |
Why do you use Also, I just see as you request json format, we haven't the html report. |
Why? |
Updating the PR...
Returns:
Image working:
To run the project locally, we need to have |
if (!url) { | ||
res.status(400).send('Please provide a URL.'); | ||
return; | ||
} | ||
|
||
const file = `report.${Date.now()}.${format}`; | ||
const fileName = `${Date.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.
let's keep the file extension
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 changed because when run:
lighthouse --output-path=reports/1509419134361 --output=json --output=html
Returns:
Printer json output written to /reports/1509419134361.report.json
Printer html output written to /reports/1509419134361.report.html
It already has the .report.{extension}
.
if (!url) { | ||
res.status(400).send('Please provide a URL.'); | ||
return; | ||
} | ||
|
||
const file = `report.${Date.now()}.${format}`; | ||
const fileName = `${Date.now()}`; | ||
const fileSavePath = `reports/${fileName}`; |
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.
Did you run this locally in Docker? Is the reports
directory accessible and have the correct permissions?
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.
const args = [ | ||
`--output-path=${fileSavePath}`, | ||
`--output=${format}`, | ||
'--output=html', |
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.
remove
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.
If we remove it, we will not have the .html
report. 😕
const child = spawn('lighthouse', [...args, url]); | ||
|
||
child.stderr.on('data', data => { | ||
console.log(data.toString()); | ||
}); | ||
|
||
child.on('close', statusCode => { | ||
const serverOrigin = `https://${req.host}/`; |
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.
https isn't going to work locally.
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 copied from the stream function:
builder/server.js
Outdated
const serverOrigin = `https://${req.host}/`; | ||
|
||
const file = `${fileSavePath}.report.${format}`; | ||
let fileContent = require(`/${file}`); |
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 wont be JS if the format
that was required is html....
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.
Oh, right! I have treated it as if it could only be a json file.
Fixes #11.