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 deleted file mode 100644 index 737b3381..00000000 --- a/.github/workflows/main-coverage.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Code Coverage (main) -on: - push: - branches: - - 'main' - -permissions: - 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 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 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: diff --git a/.github/workflows/verifications.yml b/.github/workflows/verifications.yml index c8d2df3d..2ccc737a 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: @@ -65,7 +65,16 @@ jobs: - name: Run tests run: pnpm run test:ci - - name: Upload coverage reports to Codecov + - name: Upload tests coverage report uses: codecov/codecov-action@v5 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + if: ${{ !cancelled() && github.event.action != 'closed' }} + with: + use_oidc: true + report_type: 'coverage' + + - name: Upload tests result report + uses: codecov/codecov-action@v5 + if: ${{ !cancelled() && github.event.action != 'closed' }} + with: + use_oidc: true + report_type: 'test_results' 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/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 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', + }, }, });