From 8c4e68f531bb1faf6e6653cf5feb0788160072ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 14:52:55 +0100 Subject: [PATCH 1/8] test: set up vitest ui --- package.json | 2 ++ pnpm-lock.yaml | 68 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index bb41ffd9..c32eb1f7 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "semantic-release": "semantic-release", "test": "vitest run", "test:ci": "vitest run --coverage", + "test:ui": "vitest --ui", "test:watch": "vitest", "type-check": "tsc --noEmit" }, @@ -66,6 +67,7 @@ "@typescript-eslint/rule-tester": "^8.15.0", "@vitest/coverage-v8": "^3.2.4", "@vitest/eslint-plugin": "^1.5.2", + "@vitest/ui": "3.2.4", "del-cli": "^6.0.0", "eslint": "^9.35.0", "eslint-config-prettier": "^10.1.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 755397ad..26691f93 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,10 +38,13 @@ importers: version: 8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2) '@vitest/coverage-v8': specifier: ^3.2.4 - version: 3.2.4(vitest@3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0)) + version: 3.2.4(vitest@3.2.4) '@vitest/eslint-plugin': specifier: ^1.5.2 - version: 1.5.2(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2)(vitest@3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0)) + version: 1.5.2(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2)(vitest@3.2.4) + '@vitest/ui': + specifier: 3.2.4 + version: 3.2.4(vitest@3.2.4) del-cli: specifier: ^6.0.0 version: 6.0.0 @@ -101,7 +104,7 @@ importers: version: 8.43.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2) vitest: specifier: ^3.2.4 - version: 3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0) + version: 3.2.4(@types/node@22.15.29)(@vitest/ui@3.2.4)(jiti@2.5.1)(yaml@2.7.0) packages: @@ -600,6 +603,9 @@ packages: resolution: {integrity: sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw==} engines: {node: '>=12'} + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + '@rollup/rollup-android-arm-eabi@4.53.3': resolution: {integrity: sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==} cpu: [arm] @@ -1121,6 +1127,11 @@ packages: '@vitest/spy@3.2.4': resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} + '@vitest/ui@3.2.4': + resolution: {integrity: sha512-hGISOaP18plkzbWEcP/QvtRW1xDXF2+96HbEX6byqQhAUbiS5oH6/9JwW+QsQCIYON2bI6QZBF+2PvOmrRZ9wA==} + peerDependencies: + vitest: 3.2.4 + '@vitest/utils@3.2.4': resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} @@ -1924,6 +1935,9 @@ packages: picomatch: optional: true + fflate@0.8.2: + resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==} + figures@2.0.0: resolution: {integrity: sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==} engines: {node: '>=4'} @@ -2678,6 +2692,10 @@ packages: resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} engines: {node: '>=16 || 14 >=14.17'} + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -3253,6 +3271,10 @@ packages: simple-git@3.27.0: resolution: {integrity: sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==} + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + skin-tone@2.0.0: resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==} engines: {node: '>=8'} @@ -3476,6 +3498,10 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + traverse@0.6.8: resolution: {integrity: sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==} engines: {node: '>= 0.4'} @@ -4311,6 +4337,8 @@ snapshots: '@pnpm/network.ca-file': 1.0.2 config-chain: 1.1.13 + '@polka/url@1.0.0-next.29': {} + '@rollup/rollup-android-arm-eabi@4.53.3': optional: true @@ -4775,7 +4803,7 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.11.1': optional: true - '@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0))': + '@vitest/coverage-v8@3.2.4(vitest@3.2.4)': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 1.0.2 @@ -4790,18 +4818,18 @@ snapshots: std-env: 3.10.0 test-exclude: 7.0.1 tinyrainbow: 2.0.0 - vitest: 3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0) + vitest: 3.2.4(@types/node@22.15.29)(@vitest/ui@3.2.4)(jiti@2.5.1)(yaml@2.7.0) transitivePeerDependencies: - supports-color - '@vitest/eslint-plugin@1.5.2(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2)(vitest@3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0))': + '@vitest/eslint-plugin@1.5.2(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2)(vitest@3.2.4)': dependencies: '@typescript-eslint/scope-manager': 8.49.0 '@typescript-eslint/utils': 8.49.0(eslint@9.35.0(jiti@2.5.1))(typescript@5.7.2) eslint: 9.35.0(jiti@2.5.1) optionalDependencies: typescript: 5.7.2 - vitest: 3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0) + vitest: 3.2.4(@types/node@22.15.29)(@vitest/ui@3.2.4)(jiti@2.5.1)(yaml@2.7.0) transitivePeerDependencies: - supports-color @@ -4841,6 +4869,17 @@ snapshots: dependencies: tinyspy: 4.0.4 + '@vitest/ui@3.2.4(vitest@3.2.4)': + dependencies: + '@vitest/utils': 3.2.4 + fflate: 0.8.2 + flatted: 3.3.3 + pathe: 2.0.3 + sirv: 3.0.2 + tinyglobby: 0.2.15 + tinyrainbow: 2.0.0 + vitest: 3.2.4(@types/node@22.15.29)(@vitest/ui@3.2.4)(jiti@2.5.1)(yaml@2.7.0) + '@vitest/utils@3.2.4': dependencies: '@vitest/pretty-format': 3.2.4 @@ -5811,6 +5850,8 @@ snapshots: optionalDependencies: picomatch: 4.0.3 + fflate@0.8.2: {} + figures@2.0.0: dependencies: escape-string-regexp: 1.0.5 @@ -6600,6 +6641,8 @@ snapshots: minipass@7.1.2: {} + mrmime@2.0.1: {} + ms@2.1.3: {} mz@2.7.0: @@ -7197,6 +7240,12 @@ snapshots: transitivePeerDependencies: - supports-color + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + skin-tone@2.0.0: dependencies: unicode-emoji-modifier-base: 1.0.0 @@ -7422,6 +7471,8 @@ snapshots: dependencies: is-number: 7.0.0 + totalist@3.0.1: {} + traverse@0.6.8: {} ts-api-utils@2.1.0(typescript@5.7.2): @@ -7636,7 +7687,7 @@ snapshots: jiti: 2.5.1 yaml: 2.7.0 - vitest@3.2.4(@types/node@22.15.29)(jiti@2.5.1)(yaml@2.7.0): + vitest@3.2.4(@types/node@22.15.29)(@vitest/ui@3.2.4)(jiti@2.5.1)(yaml@2.7.0): dependencies: '@types/chai': 5.2.3 '@vitest/expect': 3.2.4 @@ -7663,6 +7714,7 @@ snapshots: why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 22.15.29 + '@vitest/ui': 3.2.4(vitest@3.2.4) transitivePeerDependencies: - jiti - less From d6f461411e6f5d658288668a171fa97ad4a59f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 14:59:38 +0100 Subject: [PATCH 2/8] ci: use OIDC for Codecov auth --- .github/workflows/ci.yml | 2 -- .github/workflows/main-coverage.yml | 5 +++-- .github/workflows/verifications.yml | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a45f83e..970bb07c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,6 @@ jobs: verifications: name: Verifications uses: ./.github/workflows/verifications.yml - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} required-checks: name: Require CI status checks diff --git a/.github/workflows/main-coverage.yml b/.github/workflows/main-coverage.yml index 737b3381..73f2459f 100644 --- a/.github/workflows/main-coverage.yml +++ b/.github/workflows/main-coverage.yml @@ -5,6 +5,7 @@ on: - 'main' permissions: + id-token: write # OIDC auth for Codecov contents: read statuses: write @@ -34,5 +35,5 @@ jobs: - name: Upload coverage report uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + use_oidc: true diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index c8d2df3d..89e90f98 100644 --- a/.github/workflows/verifications.yml +++ b/.github/workflows/verifications.yml @@ -2,9 +2,9 @@ name: Verifications on: workflow_call: - secrets: - CODECOV_TOKEN: - required: true + +permissions: + id-token: write # OIDC auth for Codecov jobs: code-validation: @@ -67,5 +67,5 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + use_oidc: true From 1c78ccce21becee33abb3c3e02f806ec1e8d5958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 15:07:10 +0100 Subject: [PATCH 3/8] ci: run verifications before publishing --- .github/workflows/main-coverage.yml | 39 ----------------------------- .github/workflows/release.yml | 5 ++++ 2 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/main-coverage.yml diff --git a/.github/workflows/main-coverage.yml b/.github/workflows/main-coverage.yml deleted file mode 100644 index 73f2459f..00000000 --- a/.github/workflows/main-coverage.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Code Coverage (main) -on: - push: - branches: - - 'main' - -permissions: - id-token: write # OIDC auth for Codecov - contents: read - statuses: write - -jobs: - coverage: - name: Code Coverage - runs-on: ubuntu-latest - timeout-minutes: 3 - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Set up Node - uses: actions/setup-node@v6 - with: - cache: 'pnpm' - node-version-file: '.nvmrc' - - - name: Install dependencies - run: pnpm install - - - name: Run tests with coverage - run: pnpm run test:ci - - - name: Upload coverage report - uses: codecov/codecov-action@v5 - with: - use_oidc: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a7397f0..90607809 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,9 +22,14 @@ permissions: pull-requests: write # to be able to comment on released pull requests jobs: + verifications: + name: Verifications + uses: ./.github/workflows/verifications.yml + publish: name: Publish package runs-on: ubuntu-latest + needs: [verifications] # Avoid publishing in forks if: github.repository == 'testing-library/eslint-plugin-testing-library' steps: From c3d51ecb5482de74c1c99c0e47180fe8c2a844f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 15:12:57 +0100 Subject: [PATCH 4/8] ci: upload tests results to Codecov --- .github/workflows/verifications.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index 89e90f98..306dd930 100644 --- a/.github/workflows/verifications.yml +++ b/.github/workflows/verifications.yml @@ -65,7 +65,14 @@ jobs: - name: Run tests run: pnpm run test:ci - - name: Upload coverage reports to Codecov + - name: Upload coverage report to Codecov uses: codecov/codecov-action@v5 with: use_oidc: true + report_type: 'coverage' + + - name: Upload tests results report to Codecov + uses: codecov/codecov-action@v5 + with: + use_oidc: true + report_type: 'test_results' From 7c477a02789dcfa3068eb6661a1eb59692be073c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 15:18:07 +0100 Subject: [PATCH 5/8] ci: increase tests timeout --- .github/workflows/verifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index 306dd930..b4efef2b 100644 --- a/.github/workflows/verifications.yml +++ b/.github/workflows/verifications.yml @@ -37,7 +37,7 @@ jobs: tests: name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }}) runs-on: ubuntu-latest - timeout-minutes: 3 + timeout-minutes: 5 strategy: fail-fast: false matrix: From dc0f0e62795c43e4c2d5ae985fa31e4b2817ee5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 16:40:21 +0100 Subject: [PATCH 6/8] Revert "ci: increase tests timeout" This reverts commit 7c477a02789dcfa3068eb6661a1eb59692be073c. --- .github/workflows/verifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index b4efef2b..306dd930 100644 --- a/.github/workflows/verifications.yml +++ b/.github/workflows/verifications.yml @@ -37,7 +37,7 @@ jobs: tests: name: Tests (Node v${{ matrix.node }} - ESLint v${{ matrix.eslint }}) runs-on: ubuntu-latest - timeout-minutes: 5 + timeout-minutes: 3 strategy: fail-fast: false matrix: From 4fc58b34de418f645d01b54d63a1a67e4f037b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 16:43:16 +0100 Subject: [PATCH 7/8] ci: upload tests reports if not cancelled --- .github/workflows/verifications.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index 306dd930..2ccc737a 100644 --- a/.github/workflows/verifications.yml +++ b/.github/workflows/verifications.yml @@ -65,14 +65,16 @@ jobs: - name: Run tests run: pnpm run test:ci - - name: Upload coverage report to Codecov + - name: Upload tests coverage report uses: codecov/codecov-action@v5 + if: ${{ !cancelled() && github.event.action != 'closed' }} with: use_oidc: true report_type: 'coverage' - - name: Upload tests results report to Codecov + - name: Upload tests result report uses: codecov/codecov-action@v5 + if: ${{ !cancelled() && github.event.action != 'closed' }} with: use_oidc: true report_type: 'test_results' From 2c713f9fd8d7f9c808df96da20176e1d40d60eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Beltr=C3=A1n?= Date: Fri, 12 Dec 2025 16:55:58 +0100 Subject: [PATCH 8/8] ci: generate junit report --- .gitignore | 2 ++ vitest.config.mts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 776666b4..8bd8d381 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ pids # Directory for instrumented libs generated by jscoverage/JSCover lib-cov +test-report.junit.xml # Coverage directory used by tools like istanbul coverage @@ -64,6 +65,7 @@ typings/ yarn-error.log .pnp/ .pnp.js + # Yarn Integrity file .yarn-integrity diff --git a/vitest.config.mts b/vitest.config.mts index 599be92c..c8e1b190 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -1,9 +1,10 @@ -import { defineConfig } from 'vitest/config'; +import { defineConfig, configDefaults } from 'vitest/config'; export default defineConfig({ test: { include: ['**/tests/**/*.test.ts'], setupFiles: ['./vitest.setup.mts'], + clearMocks: true, coverage: { include: ['lib/**'], thresholds: { @@ -13,5 +14,10 @@ export default defineConfig({ statements: 90, }, }, + // Enable JUnit reporter in CI environment + reporters: process.env.CI ? ['default', 'junit'] : configDefaults.reporters, + outputFile: { + junit: 'test-report.junit.xml', + }, }, });