Skip to content

Commit

Permalink
update all snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Nov 17, 2020
1 parent 3a0a3b3 commit 75c28f1
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Object {
exports[`Performance: metrics evaluates valid input correctly 1`] = `
Object {
"cumulativeLayoutShift": 0,
"estimatedInputLatency": 78,
"estimatedInputLatency": 81,
"estimatedInputLatencyTs": undefined,
"firstCPUIdle": 3351,
"firstCPUIdleTs": undefined,
Expand Down Expand Up @@ -137,6 +137,6 @@ Object {
"observedTraceEndTs": 225426711887,
"speedIndex": 1676,
"speedIndexTs": undefined,
"totalBlockingTime": 726,
"totalBlockingTime": 777,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ describe('Render blocking resources audit', () => {
'url': 'https://fonts.googleapis.com/css?family=Fira+Sans+Condensed%3A400%2C400i%2C600%2C600i&subset=latin%2Clatin-ext&display=swap',
'wastedMs': 440,
},
{
'totalBytes': 621,
'url': 'https://fonts.googleapis.com/css?family=Montserrat',
'wastedMs': 440,
},
// Due to internal H2 simulation details, parallel HTTP/2 requests are pipelined which makes
// it look like Montserrat starts after Fira Sans finishes. It would be preferred
// if eventual simulation improvements list Montserrat here as well.
]);
});

Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/test/audits/dobetterweb/uses-http2-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ describe('Resources are fetched over http/2', () => {
// make sure we flag all the rest
expect(result.details.items).toHaveLength(60);
// make sure we report savings
expect(result.numericValue).toMatchInlineSnapshot(`1030`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`1030`);
expect(result.numericValue).toMatchInlineSnapshot(`1310`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`1310`);
// make sure we have a failing score
expect(result.score).toBeLessThan(0.5);
});
Expand All @@ -70,7 +70,7 @@ describe('Resources are fetched over http/2', () => {
expect(urls).not.toContain(records[30].url);
expect(result.details.items).toHaveLength(30);
// make sure we report less savings
expect(result.numericValue).toMatchInlineSnapshot(`250`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`250`);
expect(result.numericValue).toMatchInlineSnapshot(`850`);
expect(result.details.overallSavingsMs).toMatchInlineSnapshot(`850`);
});
});
8 changes: 4 additions & 4 deletions lighthouse-core/test/audits/timing-budget-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('Performance: Timing budget audit', () => {
context = {
computedCache: new Map(),
settings: {
throttlingMethod: 'simulate',
throttlingMethod: 'devtools',
},
};
});
Expand Down Expand Up @@ -63,15 +63,15 @@ describe('Performance: Timing budget audit', () => {
const items = result.details.items;
// Failing Budget
expect(items[0].label).toBeDisplayString('Estimated Input Latency');
expect(items[0].measurement).toBeCloseTo(77.8);
expect(items[0].overBudget).toBeCloseTo(67.8);
expect(items[0].measurement).toBeCloseTo(17.07);
expect(items[0].overBudget).toBeCloseTo(7.07);
});

it('calculates the "overBudget" column correctly', async () => {
const result = await TimingBudgetAudit.audit(artifacts, context);

// Failing Budget
expect(result.details.items[0].overBudget).toBeCloseTo(67.8);
expect(result.details.items[0].overBudget).toBeCloseTo(7.07);

// Passing Budget
expect(result.details.items[1].overBudget).toBeUndefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`Metrics: EIL should compute a simulated value 1`] = `
Object {
"optimistic": 93,
"optimistic": 101,
"pessimistic": 101,
"timing": 78,
"timing": 81,
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports[`Metrics: Lantern EIL should compute a simulated value 1`] = `
Object {
"optimistic": 93,
"optimistic": 101,
"pessimistic": 101,
"timing": 78,
"timing": 81,
}
`;
4 changes: 2 additions & 2 deletions lighthouse-core/test/computed/metrics/timing-summary-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Timing summary', () => {
expect(result.metrics).toMatchInlineSnapshot(`
Object {
"cumulativeLayoutShift": 0,
"estimatedInputLatency": 77.79999999999995,
"estimatedInputLatency": 80.93333333333328,
"estimatedInputLatencyTs": undefined,
"firstCPUIdle": 3351.3320000492963,
"firstCPUIdleTs": undefined,
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('Timing summary', () => {
"observedTraceEndTs": 225426711887,
"speedIndex": 1676.1335047609864,
"speedIndexTs": undefined,
"totalBlockingTime": 726.4774999940994,
"totalBlockingTime": 776.9999999999995,
}
`);
// Includes performance metrics
Expand Down
84 changes: 48 additions & 36 deletions lighthouse-core/test/computed/metrics/total-blocking-time-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ describe('Metrics: TotalBlockingTime', () => {
optimistic: Math.round(result.optimisticEstimate.timeInMs),
pessimistic: Math.round(result.pessimisticEstimate.timeInMs),
}).toMatchInlineSnapshot(`
Object {
"optimistic": 676,
"pessimistic": 777,
"timing": 726,
}
`);
Object {
"optimistic": 777,
"pessimistic": 777,
"timing": 777,
}
`);
});

it('should compute an observed value', async () => {
Expand Down Expand Up @@ -94,42 +94,54 @@ Object {
const fcpTimeMs = 1000;
const interactiveTimeMs = 2000;

expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1951, end: 2100, duration: 149}],
fcpTimeMs,
interactiveTimeMs
)).toBe(0); // Duration after clipping is 49, which is < 50.
expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1950, end: 2100, duration: 150}],
fcpTimeMs,
interactiveTimeMs
)).toBe(0); // Duration after clipping is 50, so time after 50ms is 0ms.
expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1949, end: 2100, duration: 151}],
fcpTimeMs,
interactiveTimeMs
)).toBe(1); // Duration after clipping is 51, so time after 50ms is 1ms.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1951, end: 2100, duration: 149}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(0); // Duration after clipping is 49, which is < 50.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1950, end: 2100, duration: 150}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(0); // Duration after clipping is 50, so time after 50ms is 0ms.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 1949, end: 2100, duration: 151}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(1); // Duration after clipping is 51, so time after 50ms is 1ms.
});

it('clips properly if FCP falls in the middle of a task', () => {
const fcpTimeMs = 1000;
const interactiveTimeMs = 2000;

expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1049, duration: 149}],
fcpTimeMs,
interactiveTimeMs
)).toBe(0); // Duration after clipping is 49, which is < 50.
expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1050, duration: 150}],
fcpTimeMs,
interactiveTimeMs
)).toBe(0); // Duration after clipping is 50, so time after 50ms is 0ms.
expect(TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1051, duration: 151}],
fcpTimeMs,
interactiveTimeMs
)).toBe(1); // Duration after clipping is 51, so time after 50ms is 1ms.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1049, duration: 149}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(0); // Duration after clipping is 49, which is < 50.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1050, duration: 150}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(0); // Duration after clipping is 50, so time after 50ms is 0ms.
expect(
TotalBlockingTime.calculateSumOfBlockingTime(
[{start: 900, end: 1051, duration: 151}],
fcpTimeMs,
interactiveTimeMs
)
).toBe(1); // Duration after clipping is 51, so time after 50ms is 1ms.
});

// This can happen in the lantern metric case, where we use the optimistic
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3945,9 +3945,9 @@
"id": "uses-http2",
"title": "Use HTTP/2",
"description": "HTTP/2 offers many benefits over HTTP/1.1, including binary headers, multiplexing, and server push. [Learn more](https://web.dev/uses-http2/).",
"score": 0.41,
"score": 0.34,
"scoreDisplayMode": "binary",
"numericValue": 1550,
"numericValue": 2130,
"numericUnit": "millisecond",
"displayValue": "15 requests not served via HTTP/2",
"details": {
Expand Down Expand Up @@ -4026,7 +4026,7 @@
"url": "http://localhost:10200/favicon.ico"
}
],
"overallSavingsMs": 1550
"overallSavingsMs": 2130
}
},
"uses-passive-event-listeners": {
Expand Down

0 comments on commit 75c28f1

Please sign in to comment.