-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: localize invalid URL error message #9334
Conversation
@@ -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', {}, {}) |
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.
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', {}, {}) |
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 think this one was actually throwing on invalid input for the config
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.
LGTM
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.
LGTM
fixes #8944
The
INVALID_URL
error wasn't getting localized because it's thrown before enteringRunner
, 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.