[go: nahoru, domu]

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: localize invalid URL error message #9334

Merged
merged 1 commit into from
Jul 8, 2019
Merged

core: localize invalid URL error message #9334

merged 1 commit into from
Jul 8, 2019

Conversation

brendankenny
Copy link
Member

fixes #8944

The INVALID_URL error wasn't getting localized because it's thrown before entering Runner, where errors are localized.

I thought about introducing i18n into this file, but it turns out we also check the url in Runner (when we normalize it), so this combines the checks there.

The downside is extra work gets done before checking the URL and throwing, but since it was already happening (e.g. in the CLI) after launching Chrome, etc, the only extra work is creating a Config, which is pretty fast.

In addition, none of the unit tests that were supposed to be checking this were checking it. They all asserted that some error was being thrown, and it just so happens that other errors were being thrown, so the assertions were passing 馃し鈥嶁檧 . Fixed those.

@@ -87,22 +87,26 @@ describe('Module Tests', function() {
});
});

it('should throw an error when the url is invalid', function() {
return lighthouse('https:/i-am-not-valid', {}, {})
Copy link
Member Author

Choose a reason for hiding this comment

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

fun fact: actually a valid URL according to the spec and implementation

});

it('should throw an error when the url is invalid protocol (file:///)', function() {
return lighthouse('file:///a/fake/index.html', {}, {})
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this one was actually throwing on invalid input for the config

Copy link
Collaborator
@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member
@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18n text not translated in fatal cli run
4 participants