Skip to content

Conversation

@brendankenny
Copy link
Contributor

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.

});

it('should throw an error when the url is invalid', function() {
return lighthouse('https:/i-am-not-valid', {}, {})
Copy link
Contributor 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
Contributor 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