Skip to content

Build your personal knowledge base with Trilium Notes

ci(web-clipper): enforce coverage and upload it to Codecov

Elian Doran714b13239c89
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 9e897020f5..2ca5851617 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -199,6 +199,30 @@ jobs:
disable_search: true
fail_ci_if_error: false
+ - name: Run the web clipper tests
+ id: test-web-clipper
+ run: pnpm run --filter=web-clipper test --coverage
+
+ - name: Upload web clipper coverage to Codecov
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
+ if: ${{ !cancelled() && steps.test-web-clipper.outcome == 'success' }}
+ with:
+ files: apps/web-clipper/test-output/vitest/coverage/lcov.info
+ flags: web-clipper
+ disable_search: true
+ fail_ci_if_error: false
+
+ - name: Upload web clipper test results to Codecov
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
+ if: ${{ !cancelled() && steps.test-web-clipper.outcome != 'skipped' }}
+ with:
+ report_type: test_results
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: apps/web-clipper/test-output/vitest/junit.xml
+ flags: web-clipper
+ disable_search: true
+ fail_ci_if_error: false
+
- name: Run the codemirror tests
id: test-codemirror
run: pnpm run --filter=codemirror test --coverage
@@ -296,7 +320,7 @@ jobs:
fail_ci_if_error: false
- name: Run the rest of the tests
- run: pnpm run --filter=\!client --filter=\!standalone --filter=\!server --filter=\!desktop --filter=\!commons --filter=\!ckeditor5 --filter=\!codemirror --filter=\!highlightjs --filter=\!pdfjs-viewer --filter=\!share-theme test
+ run: pnpm run --filter=\!client --filter=\!standalone --filter=\!server --filter=\!desktop --filter=\!commons --filter=\!web-clipper --filter=\!ckeditor5 --filter=\!codemirror --filter=\!highlightjs --filter=\!pdfjs-viewer --filter=\!share-theme test
# The two suites below are split out of test_dev so they run concurrently with
# it (and each other) rather than queueing behind the client/package suites.
diff --git a/apps/web-clipper/vitest.config.mts b/apps/web-clipper/vitest.config.mts
index 109ff54f1c..46b85f621a 100644
--- a/apps/web-clipper/vitest.config.mts
+++ b/apps/web-clipper/vitest.config.mts
@@ -21,7 +21,15 @@ export default defineConfig({
provider: "v8" as const,
include: [ "entrypoints/**/*.{ts,tsx}", "utils.ts" ],
exclude: [ "**/*.{test,spec}.{ts,tsx}", "**/*.d.ts" ],
- reporter: [ "text", "lcov" ]
+ // Repo-root-relative `SF:` paths, so Codecov does not match a bare `utils.ts` or
+ // `entrypoints/…/index.ts` to another project of the monorepo.
+ reporter: [ "text", [ "lcov", { projectRoot: join(import.meta.dirname, "../..") } ] ],
+ thresholds: {
+ lines: 95,
+ statements: 95,
+ functions: 95,
+ branches: 90
+ }
}
}
});
diff --git a/codecov.yml b/codecov.yml
index 1e72ce6a16..db058ba84a 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -66,6 +66,11 @@ flags:
paths:
- packages/share-theme/src/
carryforward: true
+ web-clipper:
+ paths:
+ - apps/web-clipper/entrypoints/
+ - apps/web-clipper/utils.ts
+ carryforward: true
comment:
layout: "condensed_header, condensed_files, condensed_footer"