Skip to content

Commit

Permalink
1.0.0 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alekseykulikov committed May 23, 2019
1 parent 6bbf09e commit bd70977
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 49 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ We use [JSDoc](http://usejsdoc.org/) with [TypeScript](https://github.com/Micros
```bash
npm test # run all linters && tests
npx tsc -p . # run typescript checks
npx ava test/index.js # run just AVA tests
npx ava test/index.js -u # update AVA snapshots
npm run ava # run just AVA tests
npm run ava -u # update AVA snapshots
```
6 changes: 3 additions & 3 deletions lighthouse-plugin-field-performance/utils/audit-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ function createDistributionsTable({ distributions }, timeUnit) {
const normMax = formatValue(max, { isMs: isMs(timeUnit) })

if (min === 0) {
item.category = `Fast (faster than ${normMax}${timeUnit})`
item.category = `Fast (faster than ${normMax} ${timeUnit})`
} else if (max && min === distributions[index - 1].max) {
item.category = `Average (from ${normMin}${timeUnit} to ${normMax}${timeUnit})`
item.category = `Average (from ${normMin} ${timeUnit} to ${normMax} ${timeUnit})`
} else {
item.category = `Slow (longer than ${normMin}${timeUnit})`
item.category = `Slow (longer than ${normMin} ${timeUnit})`
}

item.distribution = `${(proportion * 100).toFixed()} %`
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"first input delay"
],
"scripts": {
"test": "prettier -c lighthouse-plugin-field-performance/** script/** package.json README.md && tsc -p . && ava test/index.js",
"test": "prettier -c lighthouse-plugin-field-performance/** script/** package.json README.md && tsc -p .",
"ava": "mkdir -p results && ava test/index.js",
"mock-run": "node ./test/mock-run.js",
"test-run": "lighthouse --plugins=lighthouse-plugin-field-performance --view --chrome-flags='--headless' --output-path=./results/result.html"
},
Expand Down
86 changes: 43 additions & 43 deletions test/snapshots/test/index.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 1
{
description: 'First Contentful Paint marks the time at which the first text or image is painted.',
description: 'First Contentful Paint marks the time at which the first text or image painted. The value represents the 90th percentile of the page traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -20,20 +20,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 1.0s)',
category: 'Fast (faster than 1 s)',
distribution: '78 %',
},
{
category: 'Average (from 1.0s to 2.5s)',
category: 'Average (from 1 s to 2.5 s)',
distribution: '17 %',
},
{
category: 'Slow (longer than 2.5s)',
category: 'Slow (longer than 2.5 s)',
distribution: '5 %',
},
],
Expand All @@ -50,7 +50,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 2
{
description: 'First Input Delay shows how fast UI responded after the first interaction.',
description: 'First Input Delay indicates how fast UI responded after the first interaction. The value represents the 95th percentile of the page traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -61,20 +61,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 50ms)',
category: 'Fast (faster than 50 ms)',
distribution: '75 %',
},
{
category: 'Average (from 50ms to 250ms)',
category: 'Average (from 50 ms to 250 ms)',
distribution: '19 %',
},
{
category: 'Slow (longer than 250ms)',
category: 'Slow (longer than 250 ms)',
distribution: '6 %',
},
],
Expand All @@ -91,7 +91,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 3
{
description: 'First Contentful Paint marks the time at which the first text or image is painted.',
description: 'First Contentful Paint marks the time at which the first text or image painted. The value represents the 90th percentile of all origin traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -102,20 +102,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 1.0s)',
category: 'Fast (faster than 1 s)',
distribution: '84 %',
},
{
category: 'Average (from 1.0s to 2.5s)',
category: 'Average (from 1 s to 2.5 s)',
distribution: '13 %',
},
{
category: 'Slow (longer than 2.5s)',
category: 'Slow (longer than 2.5 s)',
distribution: '4 %',
},
],
Expand All @@ -132,7 +132,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 4
{
description: 'First Input Delay shows how fast UI responded after the first interaction.',
description: 'First Input Delay indicates how fast UI responded after the first interaction. The value represents the 95th percentile of all origin traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -143,20 +143,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 50ms)',
category: 'Fast (faster than 50 ms)',
distribution: '74 %',
},
{
category: 'Average (from 50ms to 250ms)',
category: 'Average (from 50 ms to 250 ms)',
distribution: '17 %',
},
{
category: 'Slow (longer than 250ms)',
category: 'Slow (longer than 250 ms)',
distribution: '9 %',
},
],
Expand Down Expand Up @@ -195,7 +195,7 @@ Generated by [AVA](https://ava.li).
weight: 0,
},
],
description: 'Real Chrome users metrics over the last 30 days.',
description: 'These performance metrics show the performance of the page for real-world Chrome users over the last 30 days. Data is collected anonymously in the "field" and provided by Chrome UX Report. [Learn More](https://developers.google.com/web/tools/chrome-user-experience-report/)',
id: 'lighthouse-plugin-field-performance',
score: 0.63,
title: 'Field Performance',
Expand All @@ -206,7 +206,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 1
{
description: 'First Contentful Paint marks the time at which the first text or image is painted.',
description: 'First Contentful Paint marks the time at which the first text or image painted. The value represents the 90th percentile of the page traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -217,20 +217,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 1.0s)',
category: 'Fast (faster than 1 s)',
distribution: '68 %',
},
{
category: 'Average (from 1.0s to 2.5s)',
category: 'Average (from 1 s to 2.5 s)',
distribution: '26 %',
},
{
category: 'Slow (longer than 2.5s)',
category: 'Slow (longer than 2.5 s)',
distribution: '6 %',
},
],
Expand All @@ -247,7 +247,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 2
{
description: 'First Input Delay shows how fast UI responded after the first interaction.',
description: 'First Input Delay indicates how fast UI responded after the first interaction. The value represents the 95th percentile of the page traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -258,20 +258,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 50ms)',
category: 'Fast (faster than 50 ms)',
distribution: '96 %',
},
{
category: 'Average (from 50ms to 250ms)',
category: 'Average (from 50 ms to 250 ms)',
distribution: '2 %',
},
{
category: 'Slow (longer than 250ms)',
category: 'Slow (longer than 250 ms)',
distribution: '2 %',
},
],
Expand All @@ -288,7 +288,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 3
{
description: 'First Contentful Paint marks the time at which the first text or image is painted.',
description: 'First Contentful Paint marks the time at which the first text or image painted. The value represents the 90th percentile of all origin traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -299,26 +299,26 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 1.0s)',
category: 'Fast (faster than 1 s)',
distribution: '67 %',
},
{
category: 'Average (from 1.0s to 2.5s)',
category: 'Average (from 1 s to 2.5 s)',
distribution: '26 %',
},
{
category: 'Slow (longer than 2.5s)',
category: 'Slow (longer than 2.5 s)',
distribution: '6 %',
},
],
type: 'table',
},
displayValue: '2.0 s',
displayValue: '2 s',
id: 'field-fcp-origin',
numericValue: 1981,
score: 0.68,
Expand All @@ -329,7 +329,7 @@ Generated by [AVA](https://ava.li).
> Snapshot 4
{
description: 'First Input Delay shows how fast UI responded after the first interaction.',
description: 'First Input Delay indicates how fast UI responded after the first interaction. The value represents the 95th percentile of all origin traffic. [Learn More](https://developers.google.com/speed/docs/insights/v5/about#faq)',
details: {
headings: [
{
Expand All @@ -340,20 +340,20 @@ Generated by [AVA](https://ava.li).
{
itemType: 'text',
key: 'distribution',
text: 'Distribution',
text: 'Percent of traffic',
},
],
items: [
{
category: 'Fast (faster than 50ms)',
category: 'Fast (faster than 50 ms)',
distribution: '95 %',
},
{
category: 'Average (from 50ms to 250ms)',
category: 'Average (from 50 ms to 250 ms)',
distribution: '3 %',
},
{
category: 'Slow (longer than 250ms)',
category: 'Slow (longer than 250 ms)',
distribution: '2 %',
},
],
Expand Down Expand Up @@ -392,7 +392,7 @@ Generated by [AVA](https://ava.li).
weight: 0,
},
],
description: 'Real Chrome users metrics over the last 30 days.',
description: 'These performance metrics show the performance of the page for real-world Chrome users over the last 30 days. Data is collected anonymously in the "field" and provided by Chrome UX Report. [Learn More](https://developers.google.com/web/tools/chrome-user-experience-report/)',
id: 'lighthouse-plugin-field-performance',
score: 0.85,
title: 'Field Performance',
Expand Down
Binary file modified test/snapshots/test/index.js.snap
Binary file not shown.

0 comments on commit bd70977

Please sign in to comment.