rename config `criteria` to `audits`
This commit is contained in:
Родитель
0026adfd6d
Коммит
fc01471561
|
@ -26,7 +26,7 @@
|
|||
"items": [{
|
||||
"name": "App can load on offline/flaky connections",
|
||||
"description": "Ensuring your web app can respond when the network connection is unavailable or flaky is critical to providing your users a good experience. This is achieved through use of a <a href=\"https://developers.google.com/web/fundamentals/primers/service-worker/\">Service Worker</a>.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"service-worker": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -39,7 +39,7 @@
|
|||
}, {
|
||||
"name": "Design is mobile-friendly",
|
||||
"description": "Users increasingly experience your app on mobile devices, so it's important to ensure that the experience can adapt to smaller screens.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"viewport": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
|
|
@ -77,7 +77,7 @@ class Aggregate {
|
|||
typeof expected.rawValue === 'undefined' ||
|
||||
typeof expected.weight === 'undefined') {
|
||||
const msg =
|
||||
`aggregations: ${name} criteria does not contain expected rawValue or weight properties`;
|
||||
`aggregations: ${name} audit does not contain expected rawValue or weight properties`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
|
||||
|
@ -148,15 +148,15 @@ class Aggregate {
|
|||
*/
|
||||
static compare(results, items, aggregationIsScored) {
|
||||
return items.map(item => {
|
||||
const expectedNames = Object.keys(item.criteria);
|
||||
const expectedNames = Object.keys(item.audits);
|
||||
|
||||
// Filter down and remap the results to something more comparable to
|
||||
// the expected set of results.
|
||||
const filteredAndRemappedResults =
|
||||
Aggregate._remapResultsByName(
|
||||
Aggregate._filterResultsByAuditNames(results, item.criteria)
|
||||
Aggregate._filterResultsByAuditNames(results, item.audits)
|
||||
);
|
||||
const maxScore = Aggregate._getTotalWeight(item.criteria);
|
||||
const maxScore = Aggregate._getTotalWeight(item.audits);
|
||||
const subItems = [];
|
||||
let overallScore = 0;
|
||||
|
||||
|
@ -165,12 +165,12 @@ class Aggregate {
|
|||
expectedNames.forEach(e => {
|
||||
/* istanbul ignore if */
|
||||
// TODO(paullewis): Remove once coming soon audits have landed.
|
||||
if (item.criteria[e].comingSoon) {
|
||||
if (item.audits[e].comingSoon) {
|
||||
subItems.push({
|
||||
score: '¯\\_(ツ)_/¯', // TODO(samthor): Patch going to Closure, String.raw is badly typed
|
||||
name: 'coming-soon',
|
||||
category: item.criteria[e].category,
|
||||
description: item.criteria[e].description,
|
||||
category: item.audits[e].category,
|
||||
description: item.audits[e].description,
|
||||
comingSoon: true
|
||||
});
|
||||
|
||||
|
@ -191,7 +191,7 @@ class Aggregate {
|
|||
|
||||
overallScore += Aggregate._convertToWeight(
|
||||
filteredAndRemappedResults[e],
|
||||
item.criteria[e],
|
||||
item.audits[e],
|
||||
e);
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ var AggregationCriteria;
|
|||
function AggregationItem() {}
|
||||
|
||||
/** @type {!Object<!AggregationCriterion>} */
|
||||
AggregationItem.prototype.criteria;
|
||||
AggregationItem.prototype.audits;
|
||||
|
||||
/** @type {string} */
|
||||
AggregationItem.prototype.name;
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"items": [{
|
||||
"name": "App can load on offline/flaky connections",
|
||||
"description": "Ensuring your web app can respond when the network connection is unavailable or flaky is critical to providing your users a good experience. This is achieved through use of a <a href=\"https://developers.google.com/web/fundamentals/primers/service-worker/\">Service Worker</a>.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"service-worker": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -90,7 +90,7 @@
|
|||
},{
|
||||
"name": "Page load performance is fast",
|
||||
"description": "Users notice if sites and apps don't perform well. These top-level metrics capture the most important perceived performance concerns.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"first-meaningful-paint": {
|
||||
"rawValue": 100,
|
||||
"weight": 1
|
||||
|
@ -132,7 +132,7 @@
|
|||
}, {
|
||||
"name": "Site is progressively enhanced",
|
||||
"description": "Progressive enhancement means that everyone can access the basic content and functionality of a page in any browser, and those without certain browser features may receive a reduced but not unfunctioning experience.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"without-javascript": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -141,7 +141,7 @@
|
|||
}, {
|
||||
"name": "Network connection is secure",
|
||||
"description": "Security is an important part of the web for both developers and users. Moving forward, Transport Layer Security (TLS) support will be required for many APIs.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"is-on-https": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -155,7 +155,7 @@
|
|||
"name": "User can be prompted to Add to Homescreen",
|
||||
"description": "While users can manually add your site to their homescreen in the browser menu, the <a href=\"https://developers.google.com/web/updates/2015/03/increasing-engagement-with-app-install-banners-in-chrome-for-android?hl=en\">prompt (aka app install banner)</a> will proactively prompt the user to install the app if the below requirements are met and the user has visited your site at least twice (with at least five minutes between visits).",
|
||||
"see": "https://github.com/GoogleChrome/lighthouse/issues/23",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"service-worker": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -181,7 +181,7 @@
|
|||
"name": "Installed web app will launch with custom splash screen",
|
||||
"description": "A default splash screen will be constructed, but meeting these requirements guarantee a high-quality and customizable <a href=\"https://developers.google.com/web/updates/2015/10/splashscreen?hl=en\">splash screen</a> the user sees between tapping the home screen icon and your app’s first paint.",
|
||||
"see": "https://github.com/GoogleChrome/lighthouse/issues/24",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"manifest-exists": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -206,7 +206,7 @@
|
|||
}, {
|
||||
"name": "Address bar matches brand colors",
|
||||
"description": "The browser address bar can be themed to match your site. A theme-color <a href=\"https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android\">meta tag</a> will upgrade the address bar when a user browses the site, and the <a href=\"https://developers.google.com/web/updates/2015/08/using-manifest-to-set-sitewide-theme-color\">manifest theme-color</a> will apply the same theme site-wide once it's been added to homescreen.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"manifest-exists": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -223,7 +223,7 @@
|
|||
}, {
|
||||
"name": "Design is mobile-friendly",
|
||||
"description": "Users increasingly experience your app on mobile devices, so it's important to ensure that the experience can adapt to smaller screens.",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"viewport": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -240,7 +240,7 @@
|
|||
"scored": false,
|
||||
"categorizable": false,
|
||||
"items": [{
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"aria-allowed-attr": {
|
||||
"rawValue": true,
|
||||
"weight": 1
|
||||
|
@ -320,7 +320,7 @@
|
|||
"scored": false,
|
||||
"categorizable": false,
|
||||
"items": [{
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"critical-request-chains": {
|
||||
"rawValue": 0,
|
||||
"weight": 1
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"categorizable": true,
|
||||
"items": [{
|
||||
"name": "Using modern offline features",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"appcache-manifest": {
|
||||
"rawValue": false
|
||||
},
|
||||
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
}, {
|
||||
"name": "Using modern protocols",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"is-on-https": {
|
||||
"rawValue": false
|
||||
},
|
||||
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
}, {
|
||||
"name": "Using modern JavaScript features",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"no-datenow": {
|
||||
"rawValue": false
|
||||
},
|
||||
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
}, {
|
||||
"name": "Avoiding APIs that harm the user experience",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"no-document-write": {
|
||||
"rawValue": false
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"items": [{
|
||||
"name": "Page load performance is fast",
|
||||
"description": "",
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"first-meaningful-paint": {
|
||||
"rawValue": 100,
|
||||
"weight": 1
|
||||
|
@ -48,7 +48,7 @@
|
|||
"scored": false,
|
||||
"categorizable": false,
|
||||
"items": [{
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"critical-request-chains": {
|
||||
"rawValue": 0,
|
||||
"weight": 1
|
||||
|
|
|
@ -224,7 +224,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('scores a set correctly (contributesToScore: true)', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
'test': {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -262,7 +262,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('scores a set correctly (contributesToScore: false)', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
'test': {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -300,7 +300,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('throws when given a result containing no score property', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -320,7 +320,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('throws when given a criterion containing no rawValue property', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
weight: 1
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('filters a set correctly', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -367,7 +367,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('outputs a score', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -387,7 +387,7 @@ describe('Aggregate', () => {
|
|||
|
||||
it('outputs subitems', () => {
|
||||
const items = [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
@ -414,7 +414,7 @@ describe('Aggregate', () => {
|
|||
scored: true,
|
||||
categorizable: true,
|
||||
items: [{
|
||||
criteria: {
|
||||
audits: {
|
||||
test: {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
|
|
@ -153,7 +153,7 @@ describe('Runner', () => {
|
|||
items: [{
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
criteria: {
|
||||
audits: {
|
||||
'is-on-https': {
|
||||
value: true,
|
||||
weight: 1
|
||||
|
@ -184,7 +184,7 @@ describe('Runner', () => {
|
|||
items: [{
|
||||
name: 'name',
|
||||
description: 'description',
|
||||
criteria: {
|
||||
audits: {
|
||||
'is-on-https': {
|
||||
rawValue: true,
|
||||
weight: 1
|
||||
|
|
|
@ -81,7 +81,7 @@ window.getDefaultAggregations = function() {
|
|||
if (aggregation.items.length === 1) {
|
||||
return {
|
||||
name: aggregation.name,
|
||||
criteria: aggregation.items[0].criteria,
|
||||
audits: aggregation.items[0].audits,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ window.getDefaultAggregations = function() {
|
|||
).map(aggregation => {
|
||||
return {
|
||||
name: aggregation.name,
|
||||
audits: Object.keys(aggregation.criteria)
|
||||
audits: Object.keys(aggregation.audits)
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ Lighthouse can be used to analyze trace and performance data collected from othe
|
|||
"scored": false,
|
||||
"categorizable": false,
|
||||
"items": [{
|
||||
"criteria": {
|
||||
"audits": {
|
||||
"user-timings": { "rawValue": 0, "weight": 1 },
|
||||
"critical-request-chains": { "rawValue": 0, "weight": 1}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче