From 99d85667d93613076ec83f25eb37b8adbdfad03a Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Tue, 26 Nov 2024 10:09:57 +0530 Subject: [PATCH] new suggestions --- .github/workflows/pull-request.yml | 6 ++++++ vitest.config.ts | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4c0f69e08a..fc0ca2fcc9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -216,6 +216,12 @@ jobs: run: | npm run test:vitest:coverage + - name: Merge Coverage Reports + if: steps.changed-files.outputs.only_changed != 'true' + run: | + npx nyc merge ./coverage ./coverage-vitest ./merged-coverage + mv ./merged-coverage/coverage-final.json ./coverage/coverage-final.json + - name: TypeScript compilation for changed files run: | for file in ${{ steps.changed-files.outputs.all_files }}; do diff --git a/vitest.config.ts b/vitest.config.ts index 83500c7b37..3e64a54c9b 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -15,11 +15,21 @@ export default defineConfig({ include: ['src/**/*.spec.{js,jsx,ts,tsx}'], globals: true, environment: 'jsdom', + setupFiles: ['src/test/setup.ts'], coverage: { enabled: true, provider: 'istanbul', - reportsDirectory: './coverage', - exclude: ['node_modules', 'dist', '**/*.spec.{js,jsx,ts,tsx}'], + reportsDirectory: './coverage-vitest', + exclude: [ + 'node_modules', + 'dist', + '**/*.{spec,test}.{js,jsx,ts,tsx}', + 'coverage/**', + '**/index.{js,ts}', + '**/*.d.ts', + 'src/test/**', + 'vitest.config.ts', + ], reporter: ['text', 'html', 'text-summary', 'lcov'], }, },