Skip to content
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 full report to CLI and extension. #206

Closed
wants to merge 16 commits into from
Closed

Adds full report to CLI and extension. #206

wants to merge 16 commits into from

Conversation

paullewis
Copy link
Contributor

No description provided.

it('has no aggregators failing when shortName is called', () => {
return walkTree.then(aggregators => {
aggregators.forEach(aggregator => {
assert.doesNotThrow(_ => aggregator.shortName);
Copy link
Contributor

Choose a reason for hiding this comment

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

when would accessing a property ever cause a throw (unless you are testing that aggregator is always defined)? or am I missing something :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm confirming that all aggregators define a shortName, as the report uses it for the menu and to generate the anchor, e.g. #addtohomescreen.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah we should use .ok
https://nodejs.org/api/assert.html#assert_assert_ok_value_message

or doesNotEqual undefined then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well the base class for Aggregator throws. All we want to check is that they've overridden it in some way. I guess we could .ok as an inverse.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@samccone samccone added the +1 label Apr 19, 2016
--mobile Emulates a Nexus 5X (default=true)
--load-page Loads the page (default=true)
--output How to output the page(default=pretty)
Copy link
Member

Choose a reason for hiding this comment

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

we'll need better docs for this, but 👍 for now

@brendankenny
Copy link
Member

Looking good. A few minor things, but the major things remaining are the filename for the outputted file and if we can just have a single Report class instead of Report and two subclasses

@paullewis
Copy link
Contributor Author

Ack on the filename bug, and I could unify the report classes, but the paths aren't the same.

@paullewis
Copy link
Contributor Author

All done, and added some extra gubbins (with tests) for the printer. PTAL.

@paullewis
Copy link
Contributor Author

FYI changes now include:

  • --output=[json, pretty, html]: sets the output type (default=pretty)
  • --output-path=[stdout,/path/to/output]: sets the output location (default=stdout)

This means we can generate any type of output and either push it to stdout, or to a file of our choosing. I also added tests for the Printer since it's now doing a bunch more than it was before.

I'm not doing any path friendliness to make sure that the output directory exists. We can definitely do this, but this PR is already big enough.

@paullewis paullewis mentioned this pull request Apr 20, 2016
}

getReportHTML() {
return fs.readFileSync(path.join(__dirname, './templates/report.html'), 'utf8');
Copy link
Member

Choose a reason for hiding this comment

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

\o/

@brendankenny
Copy link
Member

should really have held off on Printer refactor for a separate PR :P

I really want to land this today, but is it too late there for additional changes?

*/
set outputMode(mode) {
if (Printer._outputModes.indexOf(mode) === -1) {
console.warn(`Unknown output mode ${mode}; using pretty`);
Copy link
Member

Choose a reason for hiding this comment

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

probably want the npmlog dance for these console.warn lines?

@paulirish
Copy link
Member

Brendan is taking over this PR

@paulirish
Copy link
Member

closing this in favor of #225

@paulirish paulirish closed this Apr 21, 2016
@paullewis paullewis deleted the dynamic-report branch April 21, 2016 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants