Skip to content

Conversation

poltorak
Copy link
Collaborator

@poltorak poltorak commented Sep 5, 2025

Centralize and Standardize Vitest Configurations

What Changed

  • New centralized configuration system: Created testing/test-setup-config package with a factory-based approach for generating Vitest configurations
  • Setup presets: Introduced modular setup file presets that can be composed for different test types (unit, integration, e2e)
  • Simplified configuration files: Refactored 6 existing Vitest config files to use the new centralized system, reducing them from verbose configurations to simple function calls

Benefits

  • Eliminates duplication: Removes repetitive boilerplate across multiple vitest config files
  • Ensures consistency: Standardizes test configurations, coverage settings, and setup files across all packages
  • Improves maintainability: Changes to test configuration defaults now only need to be made in one place
  • Better developer experience: New configs are more readable and easier to customize with sensible defaults and preset combinations

The new system provides createUnitConfig, createIntConfig, and createE2eConfig factory functions that automatically handle common configuration patterns while still allowing customization through override parameters.

Relates to first part of #1065

@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling labels Sep 5, 2025
Copy link

nx-cloud bot commented Sep 5, 2025

View your CI Pipeline Execution ↗ for commit 9433ca5

Command Status Duration Result
nx code-pushup --nx-bail -- compare ✅ Succeeded 1m 4s View ↗
nx code-pushup --nx-bail -- ✅ Succeeded 1m 27s View ↗
nx code-pushup --nx-bail -- print-config --outp... ✅ Succeeded 4m 23s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-09 14:17:53 UTC

Copy link

pkg-pr-new bot commented Sep 5, 2025

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1107

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1107

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1107

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1107

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1107

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1107

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1107

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1107

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1107

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1107

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1107

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1107

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1107

@code-pushup/models-transformers

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models-transformers@1107

commit: 9433ca5

Copy link
Contributor

github-actions bot commented Sep 5, 2025

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 0640602 with previous commit df16191.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 37 🔴 36 ↓ −1.8
Code coverage 🟡 90 🟡 90 ↓ −0.1
Security 🟡 64 🟡 64
Updates 🟡 85 🟡 85
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟡 61 🟡 61
Type Safety 🟢 100 🟢 100
Bug prevention 🟢 100 🟢 100
Miscellaneous 🟢 100 🟢 100
Code style 🟢 100 🟢 100
Documentation 🔴 24 🔴 24
👎 2 groups regressed, 👍 4 audits improved, 👎 5 audits regressed, 12 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 37 🔴 36 ↓ −1.8
Code coverage Code coverage metrics 🟡 90 🟡 90 ↓ −0.1

19 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Initial server response time was short 🟥 Root document took 650 ms 🟩 Root document took 540 ms ↓ −17 %
Lighthouse Total Blocking Time 🟥 1,640 ms 🟥 2,400 ms ↑ +46.6 %
Lighthouse First Contentful Paint 🟥 3.2 s 🟨 3.0 s ↓ −6.1 %
Lighthouse Speed Index 🟥 6.2 s 🟥 6.4 s ↑ +3.4 %
Lighthouse Time to Interactive 🟥 16.0 s 🟥 17.0 s ↑ +6.5 %
Code coverage Line coverage 🟨 86.3 % 🟨 84.4 % ↓ −2.1 %
Lighthouse Max Potential First Input Delay 🟥 800 ms 🟥 920 ms ↑ +14.9 %
Code coverage Function coverage 🟩 92.3 % 🟩 92.4 % ↑ +0.1 %
Code coverage Branch coverage 🟨 85.5 % 🟨 85.5 % ↑ +0.1 %
Lighthouse Avoids enormous network payloads 🟨 Total size was 2,687 KiB 🟨 Total size was 2,724 KiB ↑ +1.4 %
Lighthouse Minimizes main-thread work 🟥 9.6 s 🟥 11.5 s ↑ +19.8 %
Lighthouse Uses efficient cache policy on static assets 🟨 30 resources found 🟨 31 resources found ↓ −0.2 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +6.5 %
Lighthouse JavaScript execution time 🟥 4.2 s 🟥 4.9 s ↑ +18.3 %
Lighthouse Largest Contentful Paint 🟥 11.0 s 🟥 11.2 s ↑ +2.4 %
Lighthouse Server Backend Latencies 🟩 1,540 ms 🟩 1,450 ms ↓ −5.8 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 602 KiB 🟥 Potential savings of 598 KiB ↓ −1.1 %
Lighthouse Avoids an excessive DOM size 🟥 2,296 elements 🟥 2,303 elements ↑ +0.3 %
JS Packages Outdated NPM dev dependencies. 🟨 50 outdated package versions (21 major, 23 minor, 6 patch) 🟨 56 outdated package versions (21 major, 29 minor, 6 patch) ↑ +12 %
JS Packages Outdated NPM prod dependencies. 🟨 14 outdated package versions (3 major, 6 minor, 5 patch) 🟨 16 outdated package versions (3 major, 8 minor, 5 patch) ↑ +14.3 %
Lighthouse Network Round Trip Times 🟩 70 ms 🟩 70 ms ↑ +0.2 %

589 other audits are unchanged.

Copy link
Collaborator

@BioPhoton BioPhoton left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning up our test config mess :)

I left some comments.

  • please add a proper PR description that contains the scope and planned changes
  • move the config code under a Nx project in testing/vitest-setup. I updated the issue accordingly.

@poltorak poltorak marked this pull request as ready for review September 10, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants