Skip to content
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: fix serverResponseTime typo in network-server-latency #9388

Merged
merged 4 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lighthouse-core/audits/network-server-latency.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ class NetworkServerLatency extends Audit {

/** @type {number} */
let maxLatency = 0;
/** @type {Array<{origin: string, serverReponseTime: number}>} */
/** @type {Array<{origin: string, serverResponseTime: number}>} */
const results = [];
for (const [origin, serverReponseTime] of analysis.serverResponseTimeByOrigin.entries()) {
for (const [origin, serverResponseTime] of analysis.serverResponseTimeByOrigin.entries()) {
// Ignore entries that don't look like real origins, like the __SUMMARY__ entry.
if (!origin.startsWith('http')) continue;

maxLatency = Math.max(serverReponseTime, maxLatency);
results.push({origin, serverReponseTime});
maxLatency = Math.max(serverResponseTime, maxLatency);
results.push({origin, serverResponseTime});
}

results.sort((a, b) => b.serverReponseTime - a.serverReponseTime);
results.sort((a, b) => b.serverResponseTime - a.serverResponseTime);

/** @type {LH.Audit.Details.Table['headings']} */
const headings = [
{key: 'origin', itemType: 'text', text: str_(i18n.UIStrings.columnURL)},
{key: 'serverReponseTime', itemType: 'ms', granularity: 1,
{key: 'serverResponseTime', itemType: 'ms', granularity: 1,
text: str_(i18n.UIStrings.columnTimeSpent)},
];

Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/test/audits/network-server-latency-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ describe('Network Server Latency audit', () => {
const artifacts = {devtoolsLogs: {defaultPass: acceptableDevToolsLog}};
const result = await ServerLatency.audit(artifacts, {computedCache: new Map()});
result.details.items.forEach(
item => (item.serverReponseTime = Math.round(item.serverReponseTime * 100) / 100)
item => (item.serverResponseTime = Math.round(item.serverResponseTime * 100) / 100)
);

// These were all from a trace that used our ancient 150ms devtools throttling which appears as
// artifical response time = Math.max(real response time, 150ms)
expect(result.details.items).toEqual([
{
origin: 'https://www.google-analytics.com',
serverReponseTime: 159.55,
serverResponseTime: 159.55,
},
{
origin: 'https://pwa.rocks',
serverReponseTime: 159.42,
serverResponseTime: 159.42,
},
{
origin: 'https://www.googletagmanager.com',
serverReponseTime: 153.03,
serverResponseTime: 153.03,
},
]);
});
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@
"text": "URL"
},
{
"key": "serverReponseTime",
"key": "serverResponseTime",
"itemType": "ms",
"granularity": 1,
"text": "Time Spent"
Expand All @@ -1136,11 +1136,11 @@
"items": [
{
"origin": "http://localhost:10200",
"serverReponseTime": 572.829
"serverResponseTime": 572.829
},
{
"origin": "http://ajax.googleapis.com",
"serverReponseTime": 562.398
"serverResponseTime": 562.398
}
]
}
Expand Down Expand Up @@ -6336,4 +6336,4 @@
}
}
]
}
}
8 changes: 4 additions & 4 deletions proto/sample_v2_round_trip.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,18 +1824,18 @@
{
"granularity": 1.0,
"itemType": "ms",
"key": "serverReponseTime",
"key": "serverResponseTime",
"text": "Time Spent"
}
],
"items": [
{
"origin": "http://localhost:10200",
"serverReponseTime": 572.829
"serverResponseTime": 572.829
},
{
"origin": "http://ajax.googleapis.com",
"serverReponseTime": 562.398
"serverResponseTime": 562.398
}
],
"type": "table"
Expand Down Expand Up @@ -4991,4 +4991,4 @@
"total": 12345.6789
},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3358.0 Safari/537.36"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this happened? Unix vs. windows proto diff maybe?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some people have editor settings for this, though maybe you'd have to be committing through your editor for those to be triggered for these files?

}