From 4065a53a2b7e0eae65b85bb9a56c5c701061a9f2 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Mon, 14 Sep 2026 12:48:41 -0700 Subject: [PATCH] more code coverage tweaks --- .github/workflows/ci.yml | 1 - .vitestrc.coverage.ts | 24 ++++++++++++++---------- package.json | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa8e69b9b..84bf6ff4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ name: CI on: push: branches: [ master ] - pull_request: workflow_dispatch: permissions: diff --git a/.vitestrc.coverage.ts b/.vitestrc.coverage.ts index 4c8b203dd..dbb9e30aa 100644 --- a/.vitestrc.coverage.ts +++ b/.vitestrc.coverage.ts @@ -9,6 +9,7 @@ export default defineConfig({ setupFiles: ['./vitest.setup.ts'], include: [ + 'spec/**/*-spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', 'spec/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', 'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}' ], @@ -18,7 +19,8 @@ export default defineConfig({ '**/dist/**', '**/angular/**', '**/react/**', - '**/demo/**' + '**/demo/**', + '**/spec/e2e/**' // old Protractor E2E tests, not runnable under vitest ], // Enhanced coverage configuration for detailed reporting @@ -61,13 +63,13 @@ export default defineConfig({ include: ['src/**/*.{js,ts}'], // Strict coverage thresholds + // NOTE: vitest takes these keys directly - the nyc-style `global: {...}` nesting + // is silently ignored (see the same note in vitest.config.ts). thresholds: { - global: { - branches: 85, - functions: 85, - lines: 85, - statements: 85 - }, + branches: 85, + functions: 85, + lines: 85, + statements: 85, // Per-file thresholds for critical files 'src/gridstack.ts': { branches: 90, @@ -122,10 +124,12 @@ export default defineConfig({ ], // Output files for CI/CD integration + // NOTE: keep out of ./coverage - the html reporter copies the coverage dir next to + // its own output, and copying ./coverage into ./coverage/coverage fails (EINVAL) outputFile: { - html: './coverage/test-results.html', - json: './coverage/test-results.json', - junit: './coverage/junit-report.xml' + html: './test-results/detailed.html', + json: './test-results/detailed.json', + junit: './test-results/detailed-junit.xml' } } }) diff --git a/package.json b/package.json index 9b8b53e86..3e83b02ef 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "test:ui": "vitest --ui", "test:coverage": "vitest run --coverage", "test:coverage:ui": "vitest --ui --coverage.enabled=true", - "test:coverage:detailed": "vitest run --config .vitestrc.coverage.ts", + "test:coverage:detailed": "vitest run --config .vitestrc.coverage.ts --coverage", "test:coverage:html": "vitest run --coverage && open coverage/index.html", "test:coverage:lcov": "vitest run --coverage --coverage.reporter=lcov", "test:ci": "vitest run --coverage --reporter=verbose --reporter=junit --outputFile.junit=./coverage/junit-report.xml",