diff --git a/.github/workflows/ci-superdoc.yml b/.github/workflows/ci-superdoc.yml index 6187f83ceb..6b03dcaea2 100644 --- a/.github/workflows/ci-superdoc.yml +++ b/.github/workflows/ci-superdoc.yml @@ -206,9 +206,34 @@ jobs: - name: Run CLI tests run: pnpm run test:cli + coverage: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v6 + with: + node-version-file: .nvmrc + cache: pnpm + + - run: pnpm install + + - run: pnpm --filter @superdoc-dev/superdoc-yjs-collaboration build + + - run: pnpm --filter superdoc exec vitest run --coverage + + - uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: packages/superdoc/coverage/lcov.info + flags: superdoc + validate: if: always() - needs: [build, unit-tests, cli-tests] + needs: [build, unit-tests, cli-tests, coverage] runs-on: ubuntu-latest steps: - name: Check results diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..58d1399af4 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,10 @@ +coverage: + status: + project: + default: + target: auto + threshold: 1% + patch: + default: + target: auto + threshold: 1% diff --git a/packages/superdoc/vite.config.js b/packages/superdoc/vite.config.js index 5a8a95a67b..f6dfe5ae75 100644 --- a/packages/superdoc/vite.config.js +++ b/packages/superdoc/vite.config.js @@ -167,6 +167,24 @@ export default defineConfig(({ mode, command }) => { '**/*.spec.js', 'tests/umd-smoke/**', ], + coverage: { + provider: 'v8', + reporter: ['text-summary', 'lcov'], + include: ['src/**'], + exclude: [ + 'src/dev/**', + 'src/index.js', + 'src/main.js', + 'src/types.ts', + 'src/super-editor.js', + 'src/headless-toolbar.js', + 'src/headless-toolbar-react.js', + 'src/headless-toolbar-vue.js', + // Pure JSDoc typedef files (body is `export {}`, no runtime code) + 'src/core/types/**', + '**/types.js', + ], + }, }, build: { target: 'es2022',