Skip to content

Commit f175c5d

Browse files
authored
ci(superdoc): add Codecov coverage reporting (#2831)
* ci(superdoc): add Codecov coverage reporting Adds a coverage job to ci-superdoc.yml that runs vitest with v8 coverage on the superdoc package and uploads lcov to Codecov. Minimal codecov.yml with auto project + patch targets. * ci(superdoc): slim down coverage job * ci(superdoc): build yjs-collaboration before coverage tests * ci(superdoc): scope coverage to shipped src code Move coverage include/exclude into packages/superdoc/vite.config.js so local and CI agree on what counts. Excludes dev playground, build scripts, and pure re-export entry points (index.js, main.js, super-editor.js, headless-toolbar*.js). Coverage rises from ~64% to ~75% by measuring only code we ship. * ci(superdoc): exclude jsdoc typedef files from coverage
1 parent 45f1a11 commit f175c5d

3 files changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/ci-superdoc.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,34 @@ jobs:
206206
- name: Run CLI tests
207207
run: pnpm run test:cli
208208

209+
coverage:
210+
needs: build
211+
runs-on: ubuntu-latest
212+
steps:
213+
- uses: actions/checkout@v6
214+
215+
- uses: pnpm/action-setup@v4
216+
217+
- uses: actions/setup-node@v6
218+
with:
219+
node-version-file: .nvmrc
220+
cache: pnpm
221+
222+
- run: pnpm install
223+
224+
- run: pnpm --filter @superdoc-dev/superdoc-yjs-collaboration build
225+
226+
- run: pnpm --filter superdoc exec vitest run --coverage
227+
228+
- uses: codecov/codecov-action@v5
229+
with:
230+
token: ${{ secrets.CODECOV_TOKEN }}
231+
files: packages/superdoc/coverage/lcov.info
232+
flags: superdoc
233+
209234
validate:
210235
if: always()
211-
needs: [build, unit-tests, cli-tests]
236+
needs: [build, unit-tests, cli-tests, coverage]
212237
runs-on: ubuntu-latest
213238
steps:
214239
- name: Check results

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1%
7+
patch:
8+
default:
9+
target: auto
10+
threshold: 1%

packages/superdoc/vite.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ export default defineConfig(({ mode, command }) => {
167167
'**/*.spec.js',
168168
'tests/umd-smoke/**',
169169
],
170+
coverage: {
171+
provider: 'v8',
172+
reporter: ['text-summary', 'lcov'],
173+
include: ['src/**'],
174+
exclude: [
175+
'src/dev/**',
176+
'src/index.js',
177+
'src/main.js',
178+
'src/types.ts',
179+
'src/super-editor.js',
180+
'src/headless-toolbar.js',
181+
'src/headless-toolbar-react.js',
182+
'src/headless-toolbar-vue.js',
183+
// Pure JSDoc typedef files (body is `export {}`, no runtime code)
184+
'src/core/types/**',
185+
'**/types.js',
186+
],
187+
},
170188
},
171189
build: {
172190
target: 'es2022',

0 commit comments

Comments
 (0)