Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

ci: run coverage with a floor and publish the summary

Luis Ortizd4155155ec2a
diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml
index 82ea9a1..ac1a72e 100644
--- a/.github/workflows/pr-test.yml
+++ b/.github/workflows/pr-test.yml
@@ -36,8 +36,19 @@ jobs:
- name: Typecheck
run: pnpm typecheck
- - name: Run tests
- run: pnpm test
+ - name: Run tests with coverage
+ run: pnpm test:cov
+
+ - name: Publish coverage summary
+ if: always()
+ run: |
+ node -e '
+ const t = require("./coverage/coverage-summary.json").total;
+ const rows = ["statements", "branches", "functions", "lines"]
+ .map((k) => `| ${k} | ${t[k].pct}% | ${t[k].covered}/${t[k].total} |`)
+ .join("\n");
+ console.log(`## Test coverage\n\n| metric | % | covered |\n| --- | --- | --- |\n${rows}`);
+ ' >> "$GITHUB_STEP_SUMMARY"
- name: Build Chrome
run: pnpm build
diff --git a/.gitignore b/.gitignore
index 8ad14b9..c79579e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ node_modules/
.output/
.wxt/
dist/
+coverage/
.planning/
docs/
.source/
diff --git a/vitest.config.ts b/vitest.config.ts
index da8f539..c0787b1 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -12,7 +12,13 @@ export default defineConfig({
watch: false,
coverage: {
provider: "istanbul",
- reporter: ["text", "html", "lcov"],
+ reporter: ["text", "json-summary", "html", "lcov"],
+ thresholds: {
+ statements: 78,
+ branches: 66,
+ functions: 76,
+ lines: 78,
+ },
},
},
});