From 20117d113b4dadf33a2fddb55a2fb718ae2c4a8f Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Wed, 23 Jan 2019 09:31:19 -0600 Subject: [PATCH 1/3] core(manifest): remove manifest gatherer --- .../audits/installable-manifest.js | 4 +- lighthouse-core/audits/offline-start-url.js | 4 +- lighthouse-core/audits/service-worker.js | 7 ++- lighthouse-core/audits/splash-screen.js | 4 +- lighthouse-core/audits/themed-omnibox.js | 4 +- lighthouse-core/computed/manifest-values.js | 2 +- lighthouse-core/gather/gatherers/manifest.js | 23 ------- .../test/audits/installable-manifest-test.js | 16 ++--- .../test/audits/offline-start-url-test.js | 2 +- .../test/audits/service-worker-test.js | 12 ++-- .../test/audits/splash-screen-test.js | 16 ++--- .../test/audits/themed-omnibox-test.js | 12 ++-- .../test/computed/manifest-values-test.js | 60 +++++++++---------- .../test/results/artifacts/artifacts.json | 2 +- 14 files changed, 73 insertions(+), 95 deletions(-) delete mode 100644 lighthouse-core/gather/gatherers/manifest.js diff --git a/lighthouse-core/audits/installable-manifest.js b/lighthouse-core/audits/installable-manifest.js index da50e7048371..280f05d24094 100644 --- a/lighthouse-core/audits/installable-manifest.js +++ b/lighthouse-core/audits/installable-manifest.js @@ -34,7 +34,7 @@ class InstallableManifest extends MultiCheckAudit { description: 'Browsers can proactively prompt users to add your app to their homescreen, ' + 'which can lead to higher engagement. ' + '[Learn more](https://developers.google.com/web/tools/lighthouse/audits/install-prompt).', - requiredArtifacts: ['URL', 'Manifest'], + requiredArtifacts: ['URL', 'WebAppManifest'], }; } @@ -79,7 +79,7 @@ class InstallableManifest extends MultiCheckAudit { * @return {Promise<{failures: Array, manifestValues: LH.Artifacts.ManifestValues}>} */ static async audit_(artifacts, context) { - const manifestValues = await ManifestValues.request(artifacts.Manifest, context); + const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context); const manifestFailures = InstallableManifest.assessManifest(manifestValues); return { diff --git a/lighthouse-core/audits/offline-start-url.js b/lighthouse-core/audits/offline-start-url.js index fb6f0b2c8799..a964a668cea7 100644 --- a/lighthouse-core/audits/offline-start-url.js +++ b/lighthouse-core/audits/offline-start-url.js @@ -17,7 +17,7 @@ class OfflineStartUrl extends Audit { title: 'start_url responds with a 200 when offline', failureTitle: 'start_url does not respond with a 200 when offline', description: 'A service worker enables your web app to be reliable in unpredictable network conditions. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/http-200-when-offline).', - requiredArtifacts: ['Manifest', 'StartUrl'], + requiredArtifacts: ['WebAppManifest', 'StartUrl'], }; } @@ -29,7 +29,7 @@ class OfflineStartUrl extends Audit { // StartUrl gatherer will give explanations for failures, but need to take manifest parsing // warnings from the manifest itself (e.g. invalid `start_url`, so fell back to document URL). const warnings = []; - const manifest = artifacts.Manifest; + const manifest = artifacts.WebAppManifest; if (manifest && manifest.value && manifest.value.start_url.warning) { const manifestWarning = manifest.value.start_url.warning; warnings.push('We couldn\'t read the start_url from the manifest. As a result, the ' + diff --git a/lighthouse-core/audits/service-worker.js b/lighthouse-core/audits/service-worker.js index d06e651f8d6f..acb4d98b419f 100644 --- a/lighthouse-core/audits/service-worker.js +++ b/lighthouse-core/audits/service-worker.js @@ -20,7 +20,7 @@ class ServiceWorker extends Audit { description: 'The service worker is the technology that enables your app to use many ' + 'Progressive Web App features, such as offline, add to homescreen, and push ' + 'notifications. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/registered-service-worker).', - requiredArtifacts: ['URL', 'ServiceWorker', 'Manifest'], + requiredArtifacts: ['URL', 'ServiceWorker', 'WebAppManifest'], }; } @@ -64,7 +64,7 @@ class ServiceWorker extends Audit { /** * Returns a failure message if there is no start_url or if the start_url isn't * contolled by the scopeUrl. - * @param {LH.Artifacts['Manifest']} manifest + * @param {LH.Artifacts['WebAppManifest']} manifest * @param {string} scopeUrl * @return {string|undefined} */ @@ -107,7 +107,8 @@ class ServiceWorker extends Audit { }; } - const startUrlFailure = ServiceWorker.checkStartUrl(artifacts.Manifest, controllingScopeUrl); + const startUrlFailure = ServiceWorker.checkStartUrl(artifacts.WebAppManifest, + controllingScopeUrl); if (startUrlFailure) { return { rawValue: false, diff --git a/lighthouse-core/audits/splash-screen.js b/lighthouse-core/audits/splash-screen.js index 92aaae63dca9..547a7340422e 100644 --- a/lighthouse-core/audits/splash-screen.js +++ b/lighthouse-core/audits/splash-screen.js @@ -33,7 +33,7 @@ class SplashScreen extends MultiCheckAudit { description: 'A themed splash screen ensures a high-quality experience when ' + 'users launch your app from their homescreens. [Learn ' + 'more](https://developers.google.com/web/tools/lighthouse/audits/custom-splash-screen).', - requiredArtifacts: ['Manifest'], + requiredArtifacts: ['WebAppManifest'], }; } @@ -72,7 +72,7 @@ class SplashScreen extends MultiCheckAudit { /** @type {Array} */ const failures = []; - const manifestValues = await ManifestValues.request(artifacts.Manifest, context); + const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context); SplashScreen.assessManifest(manifestValues, failures); return { diff --git a/lighthouse-core/audits/themed-omnibox.js b/lighthouse-core/audits/themed-omnibox.js index c18c8f03bfad..c523942ecec0 100644 --- a/lighthouse-core/audits/themed-omnibox.js +++ b/lighthouse-core/audits/themed-omnibox.js @@ -30,7 +30,7 @@ class ThemedOmnibox extends MultiCheckAudit { failureTitle: 'Does not set an address-bar theme color', description: 'The browser address bar can be themed to match your site. ' + '[Learn more](https://developers.google.com/web/tools/lighthouse/audits/address-bar).', - requiredArtifacts: ['Manifest', 'MetaElements'], + requiredArtifacts: ['WebAppManifest', 'MetaElements'], }; } @@ -80,7 +80,7 @@ class ThemedOmnibox extends MultiCheckAudit { const failures = []; const themeColorMeta = artifacts.MetaElements.find(meta => meta.name === 'theme-color'); - const manifestValues = await ManifestValues.request(artifacts.Manifest, context); + const manifestValues = await ManifestValues.request(artifacts.WebAppManifest, context); ThemedOmnibox.assessManifest(manifestValues, failures); ThemedOmnibox.assessMetaThemecolor(themeColorMeta, failures); diff --git a/lighthouse-core/computed/manifest-values.js b/lighthouse-core/computed/manifest-values.js index 722ad5372a70..0ea269b7ab1d 100644 --- a/lighthouse-core/computed/manifest-values.js +++ b/lighthouse-core/computed/manifest-values.js @@ -77,7 +77,7 @@ class ManifestValues { /** * Returns results of all manifest checks - * @param {LH.Artifacts['Manifest']} manifest + * @param {LH.Artifacts['WebAppManifest']} manifest * @return {Promise} */ static async compute_(manifest) { diff --git a/lighthouse-core/gather/gatherers/manifest.js b/lighthouse-core/gather/gatherers/manifest.js deleted file mode 100644 index 5d0f72cbde4f..000000000000 --- a/lighthouse-core/gather/gatherers/manifest.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @license Copyright 2016 Google Inc. 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'; - -const Gatherer = require('./gatherer'); - -/** - * TODO(phulce): delete this file and move usages over to WebAppManifest - */ -class Manifest extends Gatherer { - /** - * @param {LH.Gatherer.PassContext} passContext - * @return {Promise} - */ - async afterPass(passContext) { - return passContext.baseArtifacts.WebAppManifest; - } -} - -module.exports = Manifest; diff --git a/lighthouse-core/test/audits/installable-manifest-test.js b/lighthouse-core/test/audits/installable-manifest-test.js index 79b51f60a0d1..d635407dd7bd 100644 --- a/lighthouse-core/test/audits/installable-manifest-test.js +++ b/lighthouse-core/test/audits/installable-manifest-test.js @@ -18,7 +18,7 @@ function generateMockArtifacts(src = manifestSrc) { const exampleManifest = manifestParser(src, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); const clonedArtifacts = JSON.parse(JSON.stringify({ - Manifest: exampleManifest, + WebAppManifest: exampleManifest, URL: {finalUrl: 'https://example.com'}, })); return clonedArtifacts; @@ -34,7 +34,7 @@ describe('PWA: webapp install banner audit', () => { describe('basics', () => { it('fails if page had no manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = null; + artifacts.WebAppManifest = null; const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { @@ -45,7 +45,7 @@ describe('PWA: webapp install banner audit', () => { it('fails with a non-parsable manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); + artifacts.WebAppManifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { assert.strictEqual(result.rawValue, false); @@ -55,7 +55,7 @@ describe('PWA: webapp install banner audit', () => { it('fails when an empty manifest is present', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); + artifacts.WebAppManifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { assert.strictEqual(result.rawValue, false); @@ -76,7 +76,7 @@ describe('PWA: webapp install banner audit', () => { describe('one-off-failures', () => { it('fails when a manifest contains no start_url', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.start_url.value = undefined; + artifacts.WebAppManifest.value.start_url.value = undefined; const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { @@ -92,7 +92,7 @@ describe('PWA: webapp install banner audit', () => { it('fails when a manifest contains no short_name', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.short_name.value = undefined; + artifacts.WebAppManifest.value.short_name.value = undefined; const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { @@ -108,7 +108,7 @@ describe('PWA: webapp install banner audit', () => { it('fails when a manifest contains no name', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.name.value = undefined; + artifacts.WebAppManifest.value.name.value = undefined; const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { @@ -124,7 +124,7 @@ describe('PWA: webapp install banner audit', () => { it('fails if page had no icons in the manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.icons.value = []; + artifacts.WebAppManifest.value.icons.value = []; const context = generateMockAuditContext(); return InstallableManifestAudit.audit(artifacts, context).then(result => { diff --git a/lighthouse-core/test/audits/offline-start-url-test.js b/lighthouse-core/test/audits/offline-start-url-test.js index 2d5c5597e216..2a24075cfc3c 100644 --- a/lighthouse-core/test/audits/offline-start-url-test.js +++ b/lighthouse-core/test/audits/offline-start-url-test.js @@ -59,7 +59,7 @@ describe('Offline start_url audit', () => { }; const artifacts = { - Manifest: getManifest(manifest), + WebAppManifest: getManifest(manifest), StartUrl: {statusCode: 200}, }; const context = generateMockAuditContext(); diff --git a/lighthouse-core/test/audits/service-worker-test.js b/lighthouse-core/test/audits/service-worker-test.js index 95a1aedc656a..15ecf9ee395f 100644 --- a/lighthouse-core/test/audits/service-worker-test.js +++ b/lighthouse-core/test/audits/service-worker-test.js @@ -47,15 +47,15 @@ function createSWArtifact(swOpts) { * Create a set of artifacts for the ServiceWorker audit. * @param {Array<{scriptURL: string, status: string, scopeURL?: string}>} swOpts * @param {string} finalUrl - * @param {{}}} manifestJson Manifest object or null if no manifest desired. + * @param {{}}} manifestJson WebAppManifest object or null if no manifest desired. */ function createArtifacts(swOpts, finalUrl, manifestJson) { const manifestUrl = getBaseDirectory(finalUrl) + 'manifest.json'; - let Manifest; + let WebAppManifest; if (manifestJson === null) { - Manifest = null; + WebAppManifest = null; } else if (typeof manifestJson === 'object') { - Manifest = manifestParser(JSON.stringify(manifestJson), manifestUrl, finalUrl); + WebAppManifest = manifestParser(JSON.stringify(manifestJson), manifestUrl, finalUrl); } else { throw new Error('unsupported test manifest format'); } @@ -63,7 +63,7 @@ function createArtifacts(swOpts, finalUrl, manifestJson) { return { ServiceWorker: createSWArtifact(swOpts), URL: {finalUrl}, - Manifest, + WebAppManifest, }; } @@ -290,7 +290,7 @@ describe('Offline: service worker audit', () => { }]; const artifacts = createArtifacts(swOpts, finalUrl, {}); - artifacts.Manifest = manifestParser('{,;}', finalUrl, finalUrl); + artifacts.WebAppManifest = manifestParser('{,;}', finalUrl, finalUrl); const output = ServiceWorker.audit(artifacts); expect(output).toMatchObject({ diff --git a/lighthouse-core/test/audits/splash-screen-test.js b/lighthouse-core/test/audits/splash-screen-test.js index b08ecce123fc..5f964a557aef 100644 --- a/lighthouse-core/test/audits/splash-screen-test.js +++ b/lighthouse-core/test/audits/splash-screen-test.js @@ -21,7 +21,7 @@ function generateMockArtifacts(src = manifestSrc) { const exampleManifest = manifestParser(src, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); return { - Manifest: exampleManifest, + WebAppManifest: exampleManifest, }; } function generateMockAuditContext() { @@ -35,7 +35,7 @@ describe('PWA: splash screen audit', () => { describe('basics', () => { it('fails if page had no manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = null; + artifacts.WebAppManifest = null; const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { @@ -46,7 +46,7 @@ describe('PWA: splash screen audit', () => { it('fails with a non-parsable manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); + artifacts.WebAppManifest = manifestParser('{,:}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { assert.strictEqual(result.rawValue, false); @@ -56,7 +56,7 @@ describe('PWA: splash screen audit', () => { it('fails when an empty manifest is present', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); + artifacts.WebAppManifest = manifestParser('{}', EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { assert.strictEqual(result.rawValue, false); @@ -77,7 +77,7 @@ describe('PWA: splash screen audit', () => { describe('one-off-failures', () => { it('fails when a manifest contains no name', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.name.value = undefined; + artifacts.WebAppManifest.value.name.value = undefined; const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { @@ -88,7 +88,7 @@ describe('PWA: splash screen audit', () => { it('fails when a manifest contains no background color', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.background_color.value = undefined; + artifacts.WebAppManifest.value.background_color.value = undefined; const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { @@ -111,7 +111,7 @@ describe('PWA: splash screen audit', () => { it('fails when a manifest contains no theme color', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.theme_color.value = undefined; + artifacts.WebAppManifest.value.theme_color.value = undefined; const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { @@ -122,7 +122,7 @@ describe('PWA: splash screen audit', () => { it('fails if page had no icons in the manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest.value.icons.value = []; + artifacts.WebAppManifest.value.icons.value = []; const context = generateMockAuditContext(); return SplashScreenAudit.audit(artifacts, context).then(result => { diff --git a/lighthouse-core/test/audits/themed-omnibox-test.js b/lighthouse-core/test/audits/themed-omnibox-test.js index 5cd485d7e6c4..806be9d7c2e9 100644 --- a/lighthouse-core/test/audits/themed-omnibox-test.js +++ b/lighthouse-core/test/audits/themed-omnibox-test.js @@ -16,7 +16,7 @@ const exampleManifest = noUrlManifestParser(manifestSrc); function generateMockArtifacts() { return { - Manifest: exampleManifest, + WebAppManifest: exampleManifest, MetaElements: [{name: 'theme-color', content: '#bada55'}], }; } @@ -30,7 +30,7 @@ function generateMockAuditContext() { * Simple manifest parsing helper when the manifest URLs aren't material to the * test. Uses example.com URLs for testing. * @param {string} manifestSrc - * @return {!ManifestNode<(!Manifest|undefined)>} + * @return {!ManifestNode<(!WebAppManifest|undefined)>} */ function noUrlManifestParser(manifestSrc) { return manifestParser(manifestSrc, EXAMPLE_MANIFEST_URL, EXAMPLE_DOC_URL); @@ -40,7 +40,7 @@ function noUrlManifestParser(manifestSrc) { describe('PWA: themed omnibox audit', () => { it('fails if page had no manifest', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = null; + artifacts.WebAppManifest = null; const context = generateMockAuditContext(); return ThemedOmniboxAudit.audit(artifacts, context).then(result => { @@ -53,7 +53,7 @@ describe('PWA: themed omnibox audit', () => { /* eslint-disable camelcase */ it('fails when a minimal manifest contains no theme_color', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = noUrlManifestParser(JSON.stringify({ + artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({ start_url: '/', })); const context = generateMockAuditContext(); @@ -66,7 +66,7 @@ describe('PWA: themed omnibox audit', () => { it('succeeds when a minimal manifest contains a theme_color', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = noUrlManifestParser(JSON.stringify({ + artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({ theme_color: '#bada55', })); const context = generateMockAuditContext(); @@ -129,7 +129,7 @@ describe('PWA: themed omnibox audit', () => { it('fails if HTML theme color is good, but manifest themecolor is bad', () => { const artifacts = generateMockArtifacts(); - artifacts.Manifest = noUrlManifestParser(JSON.stringify({ + artifacts.WebAppManifest = noUrlManifestParser(JSON.stringify({ start_url: '/', })); const context = generateMockAuditContext(); diff --git a/lighthouse-core/test/computed/manifest-values-test.js b/lighthouse-core/test/computed/manifest-values-test.js index 5542d5afe148..583b35400d9a 100644 --- a/lighthouse-core/test/computed/manifest-values-test.js +++ b/lighthouse-core/test/computed/manifest-values-test.js @@ -68,32 +68,32 @@ describe('ManifestValues computed artifact', () => { describe('color checks', async () => { it('fails when a minimal manifest contains no background_color', async () => { - const Manifest = noUrlManifestParser(JSON.stringify({ + const WebAppManifest = noUrlManifestParser(JSON.stringify({ start_url: '/', })); - const results = await ManifestValues.request(Manifest, getMockContext()); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const colorResults = results.allChecks.filter(i => i.id.includes('Color')); assert.equal(colorResults.every(i => i.passing === false), true); }); it('fails when a minimal manifest contains an invalid background_color', async () => { - const Manifest = noUrlManifestParser(JSON.stringify({ + const WebAppManifest = noUrlManifestParser(JSON.stringify({ background_color: 'no', theme_color: 'no', })); - const results = await ManifestValues.request(Manifest, getMockContext()); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const colorResults = results.allChecks.filter(i => i.id.includes('Color')); assert.equal(colorResults.every(i => i.passing === false), true); }); it('succeeds when a minimal manifest contains a valid background_color', async () => { - const Manifest = noUrlManifestParser(JSON.stringify({ + const WebAppManifest = noUrlManifestParser(JSON.stringify({ background_color: '#FAFAFA', theme_color: '#FAFAFA', })); - const results = await ManifestValues.request(Manifest, getMockContext()); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const colorResults = results.allChecks.filter(i => i.id.includes('Color')); assert.equal(colorResults.every(i => i.passing === true), true); }); @@ -103,20 +103,20 @@ describe('ManifestValues computed artifact', () => { const check = ManifestValues.manifestChecks.find(i => i.id === 'hasPWADisplayValue'); it('passes accepted values', () => { - let Manifest; - Manifest = noUrlManifestParser(JSON.stringify({display: 'minimal-ui'})); - assert.equal(check.validate(Manifest.value), true, 'doesnt pass minimal-ui'); - Manifest = noUrlManifestParser(JSON.stringify({display: 'standalone'})); - assert.equal(check.validate(Manifest.value), true, 'doesnt pass standalone'); - Manifest = noUrlManifestParser(JSON.stringify({display: 'fullscreen'})); - assert.equal(check.validate(Manifest.value), true, 'doesnt pass fullscreen'); + let WebAppManifest; + WebAppManifest = noUrlManifestParser(JSON.stringify({display: 'minimal-ui'})); + assert.equal(check.validate(WebAppManifest.value), true, 'doesnt pass minimal-ui'); + WebAppManifest = noUrlManifestParser(JSON.stringify({display: 'standalone'})); + assert.equal(check.validate(WebAppManifest.value), true, 'doesnt pass standalone'); + WebAppManifest = noUrlManifestParser(JSON.stringify({display: 'fullscreen'})); + assert.equal(check.validate(WebAppManifest.value), true, 'doesnt pass fullscreen'); }); it('fails invalid values', () => { - let Manifest; - Manifest = noUrlManifestParser(JSON.stringify({display: 'display'})); - assert.equal(check.validate(Manifest.value), false, 'doesnt fail display'); - Manifest = noUrlManifestParser(JSON.stringify({display: ''})); - assert.equal(check.validate(Manifest.value), false, 'doesnt fail empty string'); + let WebAppManifest; + WebAppManifest = noUrlManifestParser(JSON.stringify({display: 'display'})); + assert.equal(check.validate(WebAppManifest.value), false, 'doesnt fail display'); + WebAppManifest = noUrlManifestParser(JSON.stringify({display: ''})); + assert.equal(check.validate(WebAppManifest.value), false, 'doesnt fail empty string'); }); }); @@ -126,8 +126,8 @@ describe('ManifestValues computed artifact', () => { const manifestSrc = JSON.stringify({ name: 'NoIconsHere', }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === false), true); }); @@ -136,8 +136,8 @@ describe('ManifestValues computed artifact', () => { const manifestSrc = JSON.stringify({ icons: [], }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === false), true); }); @@ -150,8 +150,8 @@ describe('ManifestValues computed artifact', () => { src: 'icon.png', }], }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === false), true); @@ -164,8 +164,8 @@ describe('ManifestValues computed artifact', () => { sizes: '72x72 96x96 128x128 256x256 1024x1024', }], }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === true), true); @@ -180,8 +180,8 @@ describe('ManifestValues computed artifact', () => { sizes: '1256x1256', }], }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === true), true); @@ -195,8 +195,8 @@ describe('ManifestValues computed artifact', () => { sizes: '200x220', }], }); - const Manifest = noUrlManifestParser(manifestSrc); - const results = await ManifestValues.request(Manifest, getMockContext()); + const WebAppManifest = noUrlManifestParser(manifestSrc); + const results = await ManifestValues.request(WebAppManifest, getMockContext()); const iconResults = results.allChecks.filter(i => i.id.includes('Icons')); assert.equal(iconResults.every(i => i.passing === false), true); diff --git a/lighthouse-core/test/results/artifacts/artifacts.json b/lighthouse-core/test/results/artifacts/artifacts.json index 9c77c5d16907..2a3807764d7f 100644 --- a/lighthouse-core/test/results/artifacts/artifacts.json +++ b/lighthouse-core/test/results/artifacts/artifacts.json @@ -128,7 +128,7 @@ "outerHeight": 660, "devicePixelRatio": 2.625 }, - "Manifest": null, + "WebAppManifest": null, "MetaElements": [ {"name": "viewport", "content": "width=device-width, initial-scale=1, minimum-scale=1"} ], From e1321a8450ef3a9bd8d61baad15ec5198dc690c8 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Wed, 23 Jan 2019 09:33:44 -0600 Subject: [PATCH 2/3] remove from config --- lighthouse-core/config/default-config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lighthouse-core/config/default-config.js b/lighthouse-core/config/default-config.js index 5fe0e35898d2..e40c838bc123 100644 --- a/lighthouse-core/config/default-config.js +++ b/lighthouse-core/config/default-config.js @@ -87,7 +87,6 @@ const defaultConfig = { 'scripts', 'css-usage', 'viewport-dimensions', - 'manifest', 'runtime-exceptions', 'chrome-console-messages', 'accessibility', From 77990b39ddb7ad657ee75397575589b7751fc5d3 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Wed, 23 Jan 2019 09:34:13 -0600 Subject: [PATCH 3/3] update snapshot --- lighthouse-cli/test/cli/__snapshots__/index-test.js.snap | 3 --- 1 file changed, 3 deletions(-) diff --git a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap index 064368476e80..0df4f8814882 100644 --- a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap +++ b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap @@ -1041,9 +1041,6 @@ Object { Object { "path": "viewport-dimensions", }, - Object { - "path": "manifest", - }, Object { "path": "runtime-exceptions", },