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

move gt handlebars helper to accessibility formatter #929

Merged
merged 1 commit into from
Nov 10, 2016

Conversation

brendankenny
Copy link
Member

#926 started causing an error in the html formatters test when the accessibility formatter tried to use the gt handlebars helper but no such helper existed (in #926 that helper was put in report-generator.js, which doesn't run in this test). This PR moves that helper into the accessibility formatter class, which is the only place it's currently used anyways.

There are other formatters that use helpers defined in report-generator.js; the key difference is that the accessibility formatter calls on that helper even when run on empty input (as the test does), while the other formatters do not.

Interestingly Travis does not report this error in the tests. I suspect it has something to do with the global nature of the Handlebars helper registration (so perhaps other tests have already registered the report-generator.js helpers) but I haven't been able to track that down.

@brendankenny
Copy link
Member Author

confirmed that if I remove report-test.js from the unit tests that the formatter test on master fails on travis, so it looks like the difference is down to report-test.js indeed running first on travis but second locally (at least on my machine).

@@ -50,6 +50,14 @@ class Accessibilty extends Formatter {
throw new Error('Unknown formatter type');
}
}

static getHelpers() {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a magic handlebars thing?

Copy link
Member Author

Choose a reason for hiding this comment

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

is this a magic handlebars thing?

magic report-generator thing, getting any helpers from the formatter before use

@brendankenny brendankenny merged commit b13c672 into master Nov 10, 2016
@brendankenny brendankenny deleted the handlebars branch November 10, 2016 18:05
andrewrota pushed a commit to andrewrota/lighthouse that referenced this pull request Jan 13, 2017
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.

2 participants