diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-added.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-added.md index b990b08c5..43954c694 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-added.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-added.md @@ -4,11 +4,11 @@ ## ๐Ÿท๏ธ Categories -| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | -| :------------- | :--------------: | :-------------: | :--------------------------------------------------------------: | -| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **63** | ![โ†“ โˆ’5](https://img.shields.io/badge/%E2%86%93%20%E2%88%925-red) | -| Performance | _n/a (\*)_ | ๐ŸŸข **94** | _n/a (\*)_ | -| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ | +| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | +| :------------- | :--------------: | :-------------: | :------------------------------------------------------------------: | +| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **68** | ![โ†“ โˆ’0.1](https://img.shields.io/badge/%E2%86%93%20%E2%88%920.1-red) | +| Performance | _n/a (\*)_ | ๐ŸŸข **94** | _n/a (\*)_ | +| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ | _(\*) New category._ diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-improved.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-improved.md index ffd1f4306..cde9908e6 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-improved.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-improved.md @@ -33,9 +33,9 @@ | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Enforce a maximum number of lines of code in a function](https://eslint.org/docs/latest/rules/max-lines-per-function) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Require `const` declarations for variables that are never reassigned after declared](https://eslint.org/docs/latest/rules/prefer-const) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow missing `key` props in iterators/collection literals](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-key.md) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 41 other audits are unchanged. diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-mixed.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-mixed.md index ce32e05b3..c89222c34 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-mixed.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-mixed.md @@ -4,11 +4,11 @@ ## ๐Ÿท๏ธ Categories -| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | -| :------------- | :--------------: | :-------------: | :--------------------------------------------------------------: | -| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **63** | ![โ†“ โˆ’5](https://img.shields.io/badge/%E2%86%93%20%E2%88%925-red) | -| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | -| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ | +| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | +| :------------- | :--------------: | :-------------: | :------------------------------------------------------------------: | +| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | +| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **68** | ![โ†“ โˆ’0.1](https://img.shields.io/badge/%E2%86%93%20%E2%88%920.1-red) | +| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ |
๐Ÿ‘ 1 group improved, ๐Ÿ‘ 3 audits improved, ๐Ÿ‘Ž 1 audit regressed @@ -23,12 +23,12 @@ ## ๐Ÿ›ก๏ธ Audits -| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | -| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :------------------------------------------------------------------------------: | -| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | +| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :----------------------------------------------------------------------------------: | +| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 49 other audits are unchanged. diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo-with-portal.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo-with-portal.md index a8a0c0f7e..26c24e951 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo-with-portal.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo-with-portal.md @@ -37,9 +37,9 @@ | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Enforce a maximum number of lines of code in a function](https://eslint.org/docs/latest/rules/max-lines-per-function) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Require `const` declarations for variables that are never reassigned after declared](https://eslint.org/docs/latest/rules/prefer-const) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow missing `key` props in iterators/collection literals](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-key.md) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 41 other audits are unchanged. diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo.md index 8fe20bce9..36547ea94 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-monorepo.md @@ -35,9 +35,9 @@ | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Enforce a maximum number of lines of code in a function](https://eslint.org/docs/latest/rules/max-lines-per-function) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Require `const` declarations for variables that are never reassigned after declared](https://eslint.org/docs/latest/rules/prefer-const) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | | [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow missing `key` props in iterators/collection literals](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/jsx-key.md) | ๐ŸŸฅ 1 warning | ๐ŸŸฉ **passed** | ![โ†“ โˆ’100โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%92100%E2%80%89%25-green) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 41 other audits are unchanged. @@ -47,10 +47,10 @@ ๐Ÿคจ Code PushUp report has both **improvements and regressions**. -| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | -| :------------- | :--------------: | :-------------: | :--------------------------------------------------------------: | -| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **63** | ![โ†“ โˆ’5](https://img.shields.io/badge/%E2%86%93%20%E2%88%925-red) | -| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | +| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | +| :------------- | :--------------: | :-------------: | :------------------------------------------------------------------: | +| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | +| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **68** | ![โ†“ โˆ’0.1](https://img.shields.io/badge/%E2%86%93%20%E2%88%920.1-red) | 1 other category is unchanged. @@ -67,12 +67,12 @@ ### ๐Ÿ›ก๏ธ Audits -| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | -| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :------------------------------------------------------------------------------: | -| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | +| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :----------------------------------------------------------------------------------: | +| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 49 other audits are unchanged. @@ -82,10 +82,10 @@ ๐Ÿ˜Ÿ Code PushUp report has **regressed**. -| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | -| :------------- | :--------------: | :-------------: | :--------------------------------------------------------------: | -| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **63** | ![โ†“ โˆ’5](https://img.shields.io/badge/%E2%86%93%20%E2%88%925-red) | -| Performance | _n/a (\*)_ | ๐ŸŸข **94** | _n/a (\*)_ | +| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | +| :------------- | :--------------: | :-------------: | :------------------------------------------------------------------: | +| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **68** | ![โ†“ โˆ’0.1](https://img.shields.io/badge/%E2%86%93%20%E2%88%920.1-red) | +| Performance | _n/a (\*)_ | ๐ŸŸข **94** | _n/a (\*)_ | _(\*) New category._ diff --git a/packages/utils/src/lib/reports/__snapshots__/report-diff-with-portal.md b/packages/utils/src/lib/reports/__snapshots__/report-diff-with-portal.md index 07de2088e..e84e411ba 100644 --- a/packages/utils/src/lib/reports/__snapshots__/report-diff-with-portal.md +++ b/packages/utils/src/lib/reports/__snapshots__/report-diff-with-portal.md @@ -6,11 +6,11 @@ ## ๐Ÿท๏ธ Categories -| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | -| :------------- | :--------------: | :-------------: | :--------------------------------------------------------------: | -| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **63** | ![โ†“ โˆ’5](https://img.shields.io/badge/%E2%86%93%20%E2%88%925-red) | -| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | -| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ | +| ๐Ÿท๏ธ Category | โญ Previous score | โญ Current score | ๐Ÿ”„ Score change | +| :------------- | :--------------: | :-------------: | :------------------------------------------------------------------: | +| Performance | ๐ŸŸข 92 | ๐ŸŸข **94** | ![โ†‘ +2](https://img.shields.io/badge/%E2%86%91%20%2B2-green) | +| Bug prevention | ๐ŸŸก 68 | ๐ŸŸก **68** | ![โ†“ โˆ’0.1](https://img.shields.io/badge/%E2%86%93%20%E2%88%920.1-red) | +| Code style | ๐ŸŸก 54 | ๐ŸŸก **54** | โ€“ |
๐Ÿ‘ 1 group improved, ๐Ÿ‘ 3 audits improved, ๐Ÿ‘Ž 1 audit regressed @@ -25,12 +25,12 @@ ## ๐Ÿ›ก๏ธ Audits -| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | -| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :------------------------------------------------------------------------------: | -| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | -| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928%E2%80%89%25-green) | -| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | -| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’4โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%924%E2%80%89%25-green) | +| ๐Ÿ”Œ Plugin | ๐Ÿ›ก๏ธ Audit | ๐Ÿ“ Previous value | ๐Ÿ“ Current value | ๐Ÿ”„ Value change | +| :----------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- | :---------------: | :--------------: | :----------------------------------------------------------------------------------: | +| [ESLint](https://www.npmjs.com/package/@code-pushup/eslint-plugin) | [Disallow unused variables](https://eslint.org/docs/latest/rules/no-unused-vars) | ๐ŸŸฉ passed | ๐ŸŸฅ **1 error** | ![โ†‘ +โˆžโ€‰%](https://img.shields.io/badge/%E2%86%91%20%2B%E2%88%9E%E2%80%89%25-red) | +| Lighthouse | [Largest Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/largest-contentful-paint/) | ๐ŸŸจ 1.5 s | ๐ŸŸจ **1.4 s** | ![โ†“ โˆ’8.2โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%928.2%E2%80%89%25-green) | +| Lighthouse | [First Contentful Paint](https://developer.chrome.com/docs/lighthouse/performance/first-contentful-paint/) | ๐ŸŸจ 1.2 s | ๐ŸŸจ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | +| Lighthouse | [Speed Index](https://developer.chrome.com/docs/lighthouse/performance/speed-index/) | ๐ŸŸฉ 1.2 s | ๐ŸŸฉ **1.1 s** | ![โ†“ โˆ’3.6โ€‰%](https://img.shields.io/badge/%E2%86%93%20%E2%88%923.6%E2%80%89%25-green) | 49 other audits are unchanged. diff --git a/packages/utils/src/lib/reports/utils.ts b/packages/utils/src/lib/reports/utils.ts index 8341b5021..fca80013d 100644 --- a/packages/utils/src/lib/reports/utils.ts +++ b/packages/utils/src/lib/reports/utils.ts @@ -97,9 +97,19 @@ export function severityMarker(severity: 'info' | 'warning' | 'error'): string { return 'โ„น๏ธ'; } +const MIN_NON_ZERO_RESULT = 0.1; + +export function roundValue(value: number): number { + const roundedValue = Math.round(value * 10) / 10; // round with max 1 decimal + if (roundedValue === 0 && value !== 0) { + return MIN_NON_ZERO_RESULT * Math.sign(value); + } + return roundedValue; +} + export function formatScoreChange(diff: number): InlineText { const marker = getDiffMarker(diff); - const text = formatDiffNumber(Math.round(diff * 1000) / 10); // round with max 1 decimal + const text = formatDiffNumber(roundValue(diff * 100)); return colorByScoreDiff(`${marker} ${text}`, diff); } @@ -113,7 +123,7 @@ export function formatValueChange({ ? values.diff > 0 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY - : Math.round((100 * values.diff) / values.before); + : roundValue((values.diff / values.before) * 100); // eslint-disable-next-line no-irregular-whitespace const text = `${formatDiffNumber(percentage)}โ€‰%`; return colorByScoreDiff(`${marker} ${text}`, scores.diff); diff --git a/packages/utils/src/lib/reports/utils.unit.test.ts b/packages/utils/src/lib/reports/utils.unit.test.ts index ffe6de1eb..bcf3e3676 100644 --- a/packages/utils/src/lib/reports/utils.unit.test.ts +++ b/packages/utils/src/lib/reports/utils.unit.test.ts @@ -16,8 +16,11 @@ import { countWeightedRefs, formatDiffNumber, formatReportScore, + formatScoreChange, formatScoreWithColor, + formatValueChange, getPluginNameFromSlug, + roundValue, scoreMarker, severityMarker, targetScoreIcon, @@ -439,3 +442,53 @@ describe('targetScoreIcon', () => { expect(targetScoreIcon(0.42)).toBe(''); }); }); + +describe('roundValue', () => { + it.each([ + [0, 0], + [-40, -40], + [1.525, 1.5], + [-0.725, -0.7], + [0.2, 0.2], + [-0.000_02, -0.1], + ])('should round value %d to %d', (input, expected) => { + expect(roundValue(input)).toBe(expected); + }); +}); + +describe('formatScoreChange', () => { + it.each([ + [-0.4, 'โ†“ โˆ’40'], + [0.015, 'โ†‘ +1.5'], + [-0.007, 'โ†“ โˆ’0.7'], + [0.002, 'โ†‘ +0.2'], + [-0.000_000_2, 'โ†“ โˆ’0.1'], + ])( + 'should round and format raw score diff %d to be score change %s', + (diff, scoreChange) => { + expect(formatScoreChange(diff)).toHaveProperty('alt', scoreChange); + }, + ); +}); + +describe('formatValueChange', () => { + it.each([ + [{ before: 600, after: 450, diff: -150 }, 'โ†“ โˆ’25โ€‰%'], + [{ before: 1, after: 3, diff: 2 }, 'โ†‘ +200โ€‰%'], + [{ before: 0, after: 2, diff: 2 }, 'โ†‘ +โˆžโ€‰%'], + [{ before: 100, after: 101, diff: 1 }, 'โ†‘ +1โ€‰%'], + [{ before: 1000, after: 1001, diff: 1 }, 'โ†‘ +0.1โ€‰%'], + [{ before: 500, after: 499, diff: -1 }, 'โ†“ โˆ’0.2โ€‰%'], + [{ before: 123_456, after: 123_498, diff: 42 }, 'โ†‘ +0.1โ€‰%'], + ])( + 'should round and format raw value diff %o to be value change %s', + (diff, valueChange) => { + expect( + formatValueChange({ + values: diff, + scores: { before: 0, after: 0, diff: 0 }, + }), + ).toHaveProperty('alt', valueChange); + }, + ); +}); diff --git a/testing/test-utils/src/lib/utils/dynamic-mocks/report-diff.mock.ts b/testing/test-utils/src/lib/utils/dynamic-mocks/report-diff.mock.ts index 36b50799d..37b1ecbb1 100644 --- a/testing/test-utils/src/lib/utils/dynamic-mocks/report-diff.mock.ts +++ b/testing/test-utils/src/lib/utils/dynamic-mocks/report-diff.mock.ts @@ -183,7 +183,7 @@ export function reportsDiffAltMock(): ReportsDiff { { slug: 'bug-prevention' satisfies CategorySlug, title: CATEGORIES_MAP['bug-prevention'].title, - scores: { before: 0.68, after: 0.63, diff: -0.05 }, + scores: { before: 0.68, after: 0.6795, diff: -0.0005 }, }, ], unchanged: [