diff --git a/packages/cli/src/upload/upload.js b/packages/cli/src/upload/upload.js index ad8b85740..107fc3721 100644 --- a/packages/cli/src/upload/upload.js +++ b/packages/cli/src/upload/upload.js @@ -527,7 +527,9 @@ async function runFilesystemTarget(options) { /** @type {Array} */ const lhrs = loadSavedLHRs().map(lhr => JSON.parse(lhr)); /** @type {Array>} */ - const lhrsByUrl = _.groupBy(lhrs, lhr => lhr.finalUrl).map(lhrs => lhrs.map(lhr => [lhr, lhr])); + const lhrsByUrl = _.groupBy(lhrs, lhr => lhr.requestedUrl).map(lhrs => + lhrs.map(lhr => [lhr, lhr]) + ); const representativeLhrs = computeRepresentativeRuns(lhrsByUrl); const targetDir = path.resolve(process.cwd(), options.outputDir || ''); @@ -538,7 +540,7 @@ async function runFilesystemTarget(options) { const manifest = []; // Process the median LHRs last so duplicate filenames will be overwritten by the median run for (const lhr of _.sortBy(lhrs, lhr => (representativeLhrs.includes(lhr) ? 10 : 1))) { - const url = new URL(lhr.finalUrl); + const url = new URL(lhr.requestedUrl); const fetchTimeDate = new Date(new Date(lhr.fetchTime).getTime() || Date.now()); const context = { hostname: url.hostname, @@ -557,7 +559,7 @@ async function runFilesystemTarget(options) { /** @type {LHCI.UploadCommand.ManifestEntry} */ const entry = { - url: lhr.finalUrl, + url: lhr.requestedUrl, isRepresentativeRun: representativeLhrs.includes(lhr), htmlPath: path.join(targetDir, htmlPath), jsonPath: path.join(targetDir, jsonPath), diff --git a/packages/cli/test/upload-url-hash.test.js b/packages/cli/test/upload-url-hash.test.js index 49e917028..03eca79c0 100644 --- a/packages/cli/test/upload-url-hash.test.js +++ b/packages/cli/test/upload-url-hash.test.js @@ -39,19 +39,19 @@ describe('Lighthouse CI upload filesystem reports with url hash', () => { // Added unit test for PR#835 it('url with hash in the reportFilenamePattern', async () => { const lhr = JSON.parse(fs.readFileSync(fakeLhrPath, 'utf8')); - lhr.finalUrl = `https://www.example.com/#/page1`; + lhr.requestedUrl = `https://www.example.com/#/page1`; lhr.fetchTime = '2022-10-25T22:34:01.000Z'; lhr.categories.performance = {score: 0.5}; lhr.audits['first-contentful-paint'].numericValue = 900; fs.writeFileSync(fakeLhrPath.replace(/lhr-\d+/, 'lhr-4'), JSON.stringify(lhr)); - lhr.finalUrl = `https://www.example.com/#/page2`; + lhr.requestedUrl = `https://www.example.com/#/page2`; lhr.fetchTime = '2022-10-25T22:34:02.000Z'; lhr.categories.performance = {score: 0.5}; lhr.audits['first-contentful-paint'].numericValue = 1100; fs.writeFileSync(fakeLhrPath.replace(/lhr-\d+/, 'lhr-5'), JSON.stringify(lhr)); - lhr.finalUrl = `https://www.example.com/#/page3`; + lhr.requestedUrl = `https://www.example.com/#/page3`; lhr.fetchTime = '2022-10-25T22:34:03.000Z'; lhr.categories.performance = {score: 0.5}; lhr.audits['first-contentful-paint'].numericValue = 1000; diff --git a/packages/cli/test/upload.test.js b/packages/cli/test/upload.test.js index b42858062..224d50e57 100644 --- a/packages/cli/test/upload.test.js +++ b/packages/cli/test/upload.test.js @@ -159,7 +159,7 @@ describe('Lighthouse CI upload CLI', () => { it('should support target=filesystem', async () => { const lhr = JSON.parse(fs.readFileSync(fakeLhrPath, 'utf8')); - lhr.finalUrl = `https://www.example.com/page`; + lhr.requestedUrl = `https://www.example.com/page`; lhr.fetchTime = '2020-05-22T22:12:01.000Z'; lhr.audits['first-contentful-paint'].numericValue = 900; fs.writeFileSync(fakeLhrPath.replace(/lhr-\d+/, 'lhr-1'), JSON.stringify(lhr));