Skip to content

Build your personal knowledge base with Trilium Notes

ci(pdf): align pdfjs-viewer reporting with the current Codecov setup

Elian Doran379b987e722b
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 1f7be7f162..7208999d95 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -307,23 +307,26 @@ jobs:
fail_ci_if_error: false
- name: Run the pdfjs-viewer tests
+ id: test-pdfjs-viewer
run: pnpm run --filter=pdfjs-viewer test --coverage
- name: Upload pdfjs-viewer coverage to Codecov
uses: codecov/codecov-action@v7
- if: always()
+ if: ${{ !cancelled() && steps.test-pdfjs-viewer.outcome == 'success' }}
with:
files: packages/pdfjs-viewer/test-output/vitest/coverage/lcov.info
flags: pdfjs-viewer
+ disable_search: true
fail_ci_if_error: false
- name: Upload pdfjs-viewer test results to Codecov
uses: codecov/test-results-action@v1
- if: ${{ !cancelled() }}
+ if: ${{ !cancelled() && steps.test-pdfjs-viewer.outcome != 'skipped' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/pdfjs-viewer/test-output/vitest/junit.xml
flags: pdfjs-viewer
+ disable_search: true
fail_ci_if_error: false
- name: Run the rest of the tests
diff --git a/packages/pdfjs-viewer/vitest.config.ts b/packages/pdfjs-viewer/vitest.config.ts
index f99050fff8..1f071f7d4a 100644
--- a/packages/pdfjs-viewer/vitest.config.ts
+++ b/packages/pdfjs-viewer/vitest.config.ts
@@ -1,3 +1,4 @@
+import { resolve } from 'node:path';
import { defineConfig } from 'vite';
export default defineConfig(() => ({
@@ -20,7 +21,11 @@ export default defineConfig(() => ({
// custom.ts is the bundle entry point and does nothing but call into bootstrap.ts;
// importing it would run the viewer boot sequence, so the e2e suite covers it.
'exclude': ["**/*.{test,spec}.{ts,mts,cts,tsx,js,jsx}", "**/*.d.ts", "src/test/**", "src/custom.ts"],
- 'reporter': ["text", "lcov"],
+ // Codecov resolves an lcov `SF:` path by matching it against the repo's file list, so
+ // the package-relative paths istanbul emits by default (`src/index.ts`, relative to
+ // cwd) are ambiguous in this monorepo and get attributed to whichever package wins the
+ // match. Emit repo-root-relative paths instead.
+ 'reporter': ["text", ["lcov", { projectRoot: resolve(__dirname, "../..") }]],
}
},
}));