-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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(console-messages): use source-location #11899
Changes from 3 commits
dcb5e19
9c00d4b
6d562bb
28cd4c8
3736b49
7df2066
3f863c0
63bf4b2
98cb30c
9f5a4a6
c466799
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 |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
const log = require('lighthouse-logger'); | ||
const Audit = require('./audit.js'); | ||
const i18n = require('../lib/i18n/i18n.js'); | ||
const ConsoleMessages = require('../gather/gatherers/console-messages.js'); | ||
|
||
const UIStrings = { | ||
/** Title of a Lighthouse audit that provides detail on browser errors. This descriptive title is shown to users when no browser errors were logged into the devtools console. */ | ||
|
@@ -48,7 +49,6 @@ class ErrorLogs extends Audit { | |
return {}; | ||
} | ||
|
||
|
||
/** | ||
* @template {{description: string | undefined}} T | ||
* @param {Array<T>} items | ||
|
@@ -81,14 +81,15 @@ class ErrorLogs extends Audit { | |
/** @type {AuditOptions} */ | ||
const auditOptions = context.options; | ||
|
||
/** @type {Array<{source: string, description: string|undefined, url: string|undefined}>} */ | ||
/** @type {Array<{source: string, description: string|undefined, sourceLocation: LH.Audit.Details.SourceLocationValue|undefined}>} */ | ||
const consoleRows = artifacts.ConsoleMessages | ||
.filter(item => item.level === 'error') | ||
.map(item => { | ||
return { | ||
source: item.source, | ||
description: item.text, | ||
url: item.url, | ||
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. wondering if 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. I don't have a strong opinion on whether we should keep the 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. I like leaving it here too 👍 |
||
sourceLocation: ConsoleMessages.createSourceLocation(item), | ||
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. It's unfortunate that |
||
}; | ||
}); | ||
|
||
|
@@ -97,7 +98,7 @@ class ErrorLogs extends Audit { | |
|
||
/** @type {LH.Audit.Details.Table['headings']} */ | ||
const headings = [ | ||
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)}, | ||
{key: 'sourceLocation', itemType: 'source-location', text: str_(i18n.UIStrings.columnSource)}, | ||
{key: 'description', itemType: 'code', text: str_(i18n.UIStrings.columnDescription)}, | ||
]; | ||
|
||
|
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.
the call frames are now used in
ConsoleMessages
to set line/col, so we can just defer to that here now.