-
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
misc: update stack packs, remove duplicated stack pack files #11396
Changes from 8 commits
88d811c
34a16b5
69b1c5e
22e9dae
8adcbb8
2b45cec
62f956c
4a36ab5
42bbf4c
4173aa7
85277af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,4 +104,5 @@ function getStackPacks(pageStacks) { | |
|
||
module.exports = { | ||
getStackPacks, | ||
stackPacksToInclude, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
/** | ||
* @license Copyright 2020 The Lighthouse Authors. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. | ||
*/ | ||
'use strict'; | ||
|
||
/* eslint-env jest */ | ||
|
||
const lighthouseStackPacksDep = require('lighthouse-stack-packs'); | ||
const stackPacksLib = require('../../lib/stack-packs.js'); | ||
const defaultConfig = require('../../config/default-config.js'); | ||
const Config = require('../../config/config.js'); | ||
|
||
function getAuditIds() { | ||
const config = new Config(defaultConfig); | ||
return config.audits.map(a => a.implementation.meta.id); | ||
} | ||
|
||
describe('stack-packs lib', () => { | ||
it('packs without detectors', () => { | ||
const result = lighthouseStackPacksDep | ||
.filter(p => !stackPacksLib.stackPacksToInclude.find(p2 => p2.packId === p.id)) | ||
.map(p => p.id); | ||
expect(result).toMatchInlineSnapshot(` | ||
Array [ | ||
"drupal", | ||
] | ||
`); | ||
}); | ||
}); | ||
|
||
// These tests summarize the contents of the lighthouse-stack-packs package. | ||
describe('lighthouse-stack-packs dep', () => { | ||
it('snapshot packs', () => { | ||
expect(lighthouseStackPacksDep.map(p => p.id)).toMatchInlineSnapshot(` | ||
Array [ | ||
"wordpress", | ||
"drupal", | ||
"react", | ||
"angular", | ||
"amp", | ||
"magento", | ||
] | ||
`); | ||
}); | ||
|
||
// Keys should only be added, not removed. | ||
it('snapshot keys for each pack', () => { | ||
const result = lighthouseStackPacksDep.map(p => { | ||
return {id: p.id, keys: Object.keys(p.UIStrings)}; | ||
}); | ||
expect(result).toMatchInlineSnapshot(` | ||
Array [ | ||
Object { | ||
"id": "wordpress", | ||
"keys": Array [ | ||
"unused-css-rules", | ||
"uses-webp-images", | ||
"offscreen-images", | ||
"total-byte-weight", | ||
"render-blocking-resources", | ||
"unminified-css", | ||
"unminified-javascript", | ||
"efficient-animated-content", | ||
"unused-javascript", | ||
"uses-long-cache-ttl", | ||
"uses-optimized-images", | ||
"uses-text-compression", | ||
"uses-responsive-images", | ||
"time-to-first-byte", | ||
], | ||
}, | ||
Object { | ||
"id": "drupal", | ||
"keys": Array [ | ||
"unused-css-rules", | ||
"unused-javascript", | ||
"uses-webp-images", | ||
"offscreen-images", | ||
"total-byte-weight", | ||
"render-blocking-resources", | ||
"unminified-css", | ||
"unminified-javascript", | ||
"efficient-animated-content", | ||
"uses-long-cache-ttl", | ||
"uses-optimized-images", | ||
"uses-responsive-images", | ||
"time-to-first-byte", | ||
"uses-rel-preconnect", | ||
"font-display", | ||
], | ||
}, | ||
Object { | ||
"id": "react", | ||
"keys": Array [ | ||
"unminified-css", | ||
"unminified-javascript", | ||
"unused-javascript", | ||
"time-to-first-byte", | ||
"redirects", | ||
"user-timings", | ||
"dom-size", | ||
], | ||
}, | ||
Object { | ||
"id": "angular", | ||
"keys": Array [ | ||
"total-byte-weight", | ||
"unminified-warning", | ||
"unused-javascript", | ||
"uses-responsive-images", | ||
"uses-rel-preload", | ||
"dom-size", | ||
], | ||
}, | ||
Object { | ||
"id": "amp", | ||
"keys": Array [ | ||
"uses-webp-images", | ||
"offscreen-images", | ||
"render-blocking-resources", | ||
"unminified-css", | ||
"efficient-animated-content", | ||
"uses-responsive-images", | ||
], | ||
}, | ||
Object { | ||
"id": "magento", | ||
"keys": Array [ | ||
"uses-webp-images", | ||
"offscreen-images", | ||
"disable-bundling", | ||
"unminified-css", | ||
"unminified-javascript", | ||
"unused-javascript", | ||
"uses-optimized-images", | ||
"time-to-first-byte", | ||
"uses-rel-preconnect", | ||
"uses-rel-preload", | ||
"critical-request-chains", | ||
"font-display", | ||
], | ||
}, | ||
] | ||
`); | ||
}); | ||
|
||
// Keys for plugin audits are allowed in this package. | ||
// Make sure none are typos of core audits. | ||
it('snapshot unrecognized keys', () => { | ||
const auditIds = getAuditIds(); | ||
|
||
const unrecognizedKeys = new Set(); | ||
for (const pack of lighthouseStackPacksDep) { | ||
for (const key in pack.UIStrings) { | ||
if (!auditIds.includes(key)) unrecognizedKeys.add(key); | ||
} | ||
} | ||
|
||
expect([...unrecognizedKeys]).toMatchInlineSnapshot(` | ||
Array [ | ||
"time-to-first-byte", | ||
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. huzzah catching bugs already! I'm guessing it should be 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. cool, but punt GoogleChrome/lighthouse-stack-packs#50 edit: or maybe dont punt. idk 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. sure punt is fine, wasn't trying to flag this as a blocker, just celebrating the success of its implementation 🎉 :) |
||
"unminified-warning", | ||
"disable-bundling", | ||
] | ||
`); | ||
}); | ||
}); |
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.
Is this instructions for someone updating the snapshot or a description of the test?
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.
for updating the snapshot. moved it down a bit.