-
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
tests(i18n): only accept IcuMessages in toBeDisplayString #12487
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ describe('Security: HTTPS audit', () => { | |
// Unknown blocked resolution string is used as fallback. | ||
expect(result.details.items[2]).toMatchObject({ | ||
url: 'http://localhost/image2.jpeg', | ||
resolution: expect.toBeDisplayString('MixedContentBlockedLOL'), | ||
resolution: 'MixedContentBlockedLOL', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is testing that it falls back to just using the protocol-provided string when it's a string that we don't recognize, so of course it's not localized. |
||
}); | ||
|
||
expect(result.score).toBe(0); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,8 +92,7 @@ describe('Module Tests', function() { | |
try { | ||
await lighthouse('i-am-not-valid', {}, {}); | ||
} catch (err) { | ||
expect(err.friendlyMessage) | ||
.toBeDisplayString('The URL you have provided appears to be invalid.'); | ||
expect(err.friendlyMessage).toBe('The URL you have provided appears to be invalid.'); | ||
expect(err.code).toEqual('INVALID_URL'); | ||
} | ||
}); | ||
|
@@ -103,8 +102,7 @@ describe('Module Tests', function() { | |
try { | ||
await lighthouse('file:///a/fake/index.html', {}, {}); | ||
} catch (err) { | ||
expect(err.friendlyMessage) | ||
.toBeDisplayString('The URL you have provided appears to be invalid.'); | ||
expect(err.friendlyMessage).toBe('The URL you have provided appears to be invalid.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. runner localizes these internally (and there's a test for that), so they aren't |
||
expect(err.code).toEqual('INVALID_URL'); | ||
} | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -790,7 +790,7 @@ describe('Runner', () => { | |
|
||
// And it bubbled up to the runtimeError. | ||
expect(lhr.runtimeError.code).toEqual(NO_FCP.code); | ||
expect(lhr.runtimeError.message).toBeDisplayString(/did not paint any content.*\(NO_FCP\)/); | ||
expect(lhr.runtimeError.message).toMatch(/did not paint any content.*\(NO_FCP\)/); | ||
}); | ||
|
||
it('includes a pageLoadError runtimeError over any gatherer runtimeErrors', async () => { | ||
|
@@ -821,7 +821,7 @@ describe('Runner', () => { | |
|
||
// But top-level runtimeError is the pageLoadError. | ||
expect(lhr.runtimeError.code).toEqual(LHError.errors.PAGE_HUNG.code); | ||
expect(lhr.runtimeError.message).toBeDisplayString(/because the page stopped responding/); | ||
expect(lhr.runtimeError.message).toMatch(/because the page stopped responding/); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LHRs are already localized when returned from |
||
}); | ||
}); | ||
|
||
|
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.
these two are kind of weird because we're putting them in the audit table, but really they're messages to us that the protocol has diverged from what we expect, so it seems better to leave them untranslated (maybe they should be just Sentry errors and test assertions that they don't occur in CI and at least leave out the "unexpected arguments" part for users?)