perf: speed up local test runs by moving coverage to optional script
Run vitest without coverage by default (pnpm test) and add pnpm test:coverage which enforces the coverage thresholds. CI keeps using the coverage run so thresholds are still enforced on every push.
This commit is contained in:
1 parent
ecadef904d
commit
54b7c67878
5 files changed
+7
-6
No files matched your search
@@ -53,9 +53,9 @@ jobs:
|
|||||||
BCRYPT_ROUNDS: 4
|
BCRYPT_ROUNDS: 4
|
||||||
run: |
|
run: |
|
||||||
if [ -x /usr/bin/time ]; then
|
if [ -x /usr/bin/time ]; then
|
||||||
/usr/bin/time -f 'Tests: %e seconds; peak process RSS: %M KiB' pnpm test --maxWorkers=2
|
/usr/bin/time -f 'Tests: %e seconds; peak process RSS: %i KiB' pnpm test:coverage --maxWorkers=2
|
||||||
else
|
else
|
||||||
time pnpm test --maxWorkers=2
|
time pnpm test:coverage --maxWorkers=2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ─────────────────────────────────────────────
|
# ─────────────────────────────────────────────
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ jobs:
|
|||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
pnpm typecheck
|
pnpm typecheck
|
||||||
pnpm biome:lint
|
pnpm biome:lint
|
||||||
pnpm test
|
pnpm test:coverage
|
||||||
env:
|
env:
|
||||||
SKIP_ENV_VALIDATION: 1
|
SKIP_ENV_VALIDATION: 1
|
||||||
NODE_ENV: test
|
NODE_ENV: test
|
||||||
|
|||||||
+2
-1
@@ -16,7 +16,8 @@
|
|||||||
"format": "biome format --write .",
|
"format": "biome format --write .",
|
||||||
"diag:permissions": "tsx scripts/diagnose-permission-page.ts",
|
"diag:permissions": "tsx scripts/diagnose-permission-page.ts",
|
||||||
"jobs:worker": "node --conditions=react-server --import tsx scripts/jobs-worker.ts",
|
"jobs:worker": "node --conditions=react-server --import tsx scripts/jobs-worker.ts",
|
||||||
"test": "vitest run",
|
"test": "vitest run --coverage.enabled=false",
|
||||||
|
"test:coverage": "vitest run",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"db:generate": "drizzle-kit generate",
|
"db:generate": "drizzle-kit generate",
|
||||||
"db:introspect": "drizzle-kit introspect",
|
"db:introspect": "drizzle-kit introspect",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe("CI workflow", () => {
|
|||||||
it("check runs lint, typecheck, and test", () => {
|
it("check runs lint, typecheck, and test", () => {
|
||||||
expect(workflow).toContain("pnpm biome:lint");
|
expect(workflow).toContain("pnpm biome:lint");
|
||||||
expect(workflow).toContain("pnpm typecheck");
|
expect(workflow).toContain("pnpm typecheck");
|
||||||
expect(workflow).toContain("pnpm test");
|
expect(workflow).toContain("pnpm test:coverage");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("check job runs on self-hosted runner", () => {
|
it("check job runs on self-hosted runner", () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { expect, it } from "vitest";
|
|||||||
const workflow = readFileSync(".gitea/workflows/ci.yaml", "utf8");
|
const workflow = readFileSync(".gitea/workflows/ci.yaml", "utf8");
|
||||||
const deploy = readFileSync("scripts/ci-deploy.sh", "utf8");
|
const deploy = readFileSync("scripts/ci-deploy.sh", "utf8");
|
||||||
it("uses two test workers and runs smoke checks in the deployment transaction", () => {
|
it("uses two test workers and runs smoke checks in the deployment transaction", () => {
|
||||||
expect(workflow).toContain("pnpm test --maxWorkers=2");
|
expect(workflow).toContain("pnpm test:coverage --maxWorkers=2");
|
||||||
expect(workflow).not.toContain("\n e2e:");
|
expect(workflow).not.toContain("\n e2e:");
|
||||||
expect(workflow).toContain("bash scripts/ci-deploy.sh");
|
expect(workflow).toContain("bash scripts/ci-deploy.sh");
|
||||||
expect(deploy).toContain(
|
expect(deploy).toContain(
|
||||||
|
|||||||
Reference in new issue
Block a user