From 170237044758b883b3acc8a2651f86d3268e55db Mon Sep 17 00:00:00 2001 From: khannurien Date: Sun, 27 Sep 2026 20:30:05 +0000 Subject: [PATCH] =?UTF-8?q?v3:=20coverage=20tasks=20for=20both=20suites=20?= =?UTF-8?q?=E2=80=94=20`deno=20task=20test:coverage`=20runs=20the=20Deno?= =?UTF-8?q?=20tests=20of=20api/=20and=20shared/=20with=20coverage=20and=20?= =?UTF-8?q?writes=20the=20report=20to=20coverage/api,=20`deno=20task=20tes?= =?UTF-8?q?t:web:coverage`=20runs=20the=20Vitest=20suite=20with=20@vitest/?= =?UTF-8?q?coverage-v8=20(at=20vitest's=20own=205.0.2)=20into=20coverage/w?= =?UTF-8?q?eb.=20Each=20prints=20a=20table=20and=20leaves=20an=20HTML=20re?= =?UTF-8?q?port=20and=20an=20lcov.info.=20They=20write=20to=20separate=20f?= =?UTF-8?q?olders=20because=20deno=20test=20--clean=20empties=20its=20whol?= =?UTF-8?q?e=20output=20directory,=20which=20would=20take=20the=20frontend?= =?UTF-8?q?=20report=20with=20it.=20The=20frontend=20report=20counts=20src?= =?UTF-8?q?/=20without=20src/test/=20and=20the=20generated=20src/locales/;?= =?UTF-8?q?=20the=20backend=20report=20still=20lists=20api/test/helpers.ts?= =?UTF-8?q?=20and=20setup.ts,=20since=20deno.json=20has=20no=20coverage=20?= =?UTF-8?q?exclude=20and=20a=20separate=20`deno=20coverage=20--exclude`=20?= =?UTF-8?q?pass=20merged=20the=20raw=20profiles=20into=20different=20figur?= =?UTF-8?q?es.=20No=20behaviour=20changes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- deno.json | 4 ++- deno.lock | 64 +++++++++++++++++++++++++++++++++++++++++++----- package.json | 1 + vitest.config.ts | 7 ++++++ 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/deno.json b/deno.json index b80aff35..e7a4e761 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,9 @@ "i18n:compile": "deno run -A npm:@lingui/cli compile --workers 1", "start": "deno task icons dist && deno run --env-file -A api/db/init.ts && deno run --env-file -A api/main.ts", "test": "deno test -A api/ shared/", - "test:web": "deno run -A npm:vitest run" + "test:coverage": "deno test -A --coverage=coverage/api --clean api/ shared/", + "test:web": "deno run -A npm:vitest run", + "test:web:coverage": "deno run -A npm:vitest run --coverage" }, "nodeModulesDir": "auto", "compilerOptions": { diff --git a/deno.lock b/deno.lock index dad8e3dc..23060c5e 100644 --- a/deno.lock +++ b/deno.lock @@ -46,13 +46,14 @@ "npm:@resvg/resvg-wasm@2.6.2": "2.6.2", "npm:@resvg/resvg-wasm@^2.6.2": "2.6.2", "npm:@testing-library/dom@^10.4.2": "10.4.2", - "npm:@testing-library/jest-dom@^7.0.1": "7.0.1_@testing-library+dom@10.4.2_vitest@5.0.2__@types+node@26.6.3__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0__jiti@2.7.0_@types+node@26.6.3_jiti@2.7.0_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0", + "npm:@testing-library/jest-dom@^7.0.1": "7.0.1_@testing-library+dom@10.4.2_vitest@5.0.2__@types+node@26.6.3__@vitest+coverage-v8@5.0.2__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0_@vitest+coverage-v8@5.0.2__vitest@5.0.2__@types+node@26.6.3__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0", "npm:@testing-library/react@^16.3.3": "16.3.3_@testing-library+dom@10.4.2_@types+react@19.3.0_@types+react-dom@19.3.0__@types+react@19.3.0_react@19.3.0_react-dom@19.3.0__react@19.3.0", "npm:@testing-library/user-event@^14.6.7": "14.6.7_@testing-library+dom@10.4.2", "npm:@types/node@^26.6.3": "26.6.3", "npm:@types/react-dom@^19.3.0": "19.3.0_@types+react@19.3.0", "npm:@types/react@^19.3.0": "19.3.0", "npm:@vitejs/plugin-react-swc@^4.3.3": "4.3.3_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0_@types+node@26.6.3_jiti@2.7.0", + "npm:@vitest/coverage-v8@^5.0.2": "5.0.2_vitest@5.0.2_@types+node@26.6.3_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0", "npm:emojibase-data@17.0.0": "17.0.0_emojibase@17.0.0", "npm:eslint-plugin-react-hooks@^7.1.1": "7.1.1_eslint@10.11.0__jiti@2.7.0_jiti@2.7.0", "npm:eslint-plugin-react-refresh@~0.5.7": "0.5.7_eslint@10.11.0__jiti@2.7.0_jiti@2.7.0", @@ -74,8 +75,8 @@ "npm:typescript@~6.0.3": "6.0.3", "npm:vite@*": "8.3.1_@types+node@26.6.3_jiti@2.7.0", "npm:vite@^8.3.1": "8.3.1_@types+node@26.6.3_jiti@2.7.0", - "npm:vitest@*": "5.0.2_@types+node@26.6.3_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0_jiti@2.7.0", - "npm:vitest@^5.0.2": "5.0.2_@types+node@26.6.3_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0_jiti@2.7.0" + "npm:vitest@*": "5.0.2_@types+node@26.6.3_@vitest+coverage-v8@5.0.2_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0", + "npm:vitest@^5.0.2": "5.0.2_@types+node@26.6.3_@vitest+coverage-v8@5.0.2_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0" }, "jsr": { "@db/sqlite@0.13.0": { @@ -230,7 +231,7 @@ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", "dependencies": [ "@babel/helper-validator-identifier", - "js-tokens", + "js-tokens@4.0.0", "picocolors" ] }, @@ -349,6 +350,9 @@ "@babel/helper-validator-identifier" ] }, + "@bcoe/v8-coverage@1.0.2": { + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==" + }, "@bramus/specificity@2.4.2": { "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", "dependencies": [ @@ -865,7 +869,7 @@ "pretty-format@27.5.1" ] }, - "@testing-library/jest-dom@7.0.1_@testing-library+dom@10.4.2_vitest@5.0.2__@types+node@26.6.3__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0__jiti@2.7.0_@types+node@26.6.3_jiti@2.7.0_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0": { + "@testing-library/jest-dom@7.0.1_@testing-library+dom@10.4.2_vitest@5.0.2__@types+node@26.6.3__@vitest+coverage-v8@5.0.2__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0_@vitest+coverage-v8@5.0.2__vitest@5.0.2__@types+node@26.6.3__jsdom@30.1.1__vite@8.3.1___@types+node@26.6.3___jiti@2.7.0": { "integrity": "sha512-oMDTC3oA+6CXSO2JZnvOI7CA6oVub6kij5ggk9ohwye5slmkwxYDXcPOVxgMw/RQlticjtO0C1RZkR97HgrWMw==", "dependencies": [ "@adobe/css-tools", @@ -1109,6 +1113,29 @@ "vite" ] }, + "@vitest/coverage-v8@5.0.2_vitest@5.0.2_@types+node@26.6.3_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0": { + "integrity": "sha512-3ffHBEi8DOOBLwIGBhOBZbRfYFYWjMUuxZicONdhuFEFEG5AVsMOSrVeuROskqnqpbOmEJwxM2eTVZ9N3a1t+A==", + "dependencies": [ + "@bcoe/v8-coverage", + "@vitest/istanbul-lib-coverage", + "@vitest/istanbul-lib-report", + "ast-v8-to-istanbul", + "magicast", + "obug", + "std-env", + "tinyrainbow", + "vitest" + ] + }, + "@vitest/istanbul-lib-coverage@1.0.1": { + "integrity": "sha512-k3DJZ8LhMBK9NS4SclF1ASD3OgXEWDorbIcPTRDK0/Zae6fRvu+fJRxtFdLfHsa9Y24beCdPnoNZ4LviTNstfA==" + }, + "@vitest/istanbul-lib-report@1.0.1": { + "integrity": "sha512-1EOLRfsTMnyAr3+kEAsP4o9dhaDlGPpD7H5iLBBeq//YpNB1VIahkPhB+eRp9N2Dkfw8oySROjE3yf9XDeaIkQ==", + "dependencies": [ + "@vitest/istanbul-lib-coverage" + ] + }, "@vitest/mocker@5.0.2_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0_@types+node@26.6.3_jiti@2.7.0": { "integrity": "sha512-Z5FS00Q1SJHkB35xATsmWGdQ5WA1/0MV3CDjqyv7GavHv1OfOj145MNfHOlHk7QLes21dKFDHr8EO2zvL+9WGA==", "dependencies": [ @@ -1168,6 +1195,14 @@ "assertion-error@2.0.1": { "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==" }, + "ast-v8-to-istanbul@1.0.7": { + "integrity": "sha512-kFL68AG6ajd8fg248zwM9GQrUWEp79gsmjum34OEXjs4yHuUMZfYKwOLW9GMmB4oNvVrj+EAGxsP7ye2UR9UlA==", + "dependencies": [ + "@jridgewell/trace-mapping", + "estree-walker", + "js-tokens@10.0.0" + ] + }, "bail@2.0.2": { "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==" }, @@ -1725,6 +1760,9 @@ "js-sha256@0.10.1": { "integrity": "sha512-5obBtsz9301ULlsgggLg542s/jqtddfOpV5KJc4hajc9JV8GeY2gZHSVpYBn4nWqAUTJ9v+xwtbJ1mIBgIH5Vw==" }, + "js-tokens@10.0.0": { + "integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==" + }, "js-tokens@4.0.0": { "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, @@ -1895,6 +1933,14 @@ "@jridgewell/sourcemap-codec" ] }, + "magicast@0.5.5": { + "integrity": "sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==", + "dependencies": [ + "@babel/parser", + "@babel/types", + "source-map-js" + ] + }, "markdown-table@3.0.4": { "integrity": "sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==" }, @@ -2739,6 +2785,9 @@ "tinypool@2.2.0": { "integrity": "sha512-jBrmx4lYmaC9k/mgPbylxs7kBUxHtD8256up+HjLaDFfXScKJQyil+SWXSvhAtT7XHo+yTVlpB81PGmHP8oLSQ==" }, + "tinyrainbow@3.1.1": { + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==" + }, "tldts-core@7.4.15": { "integrity": "sha512-ERuv0p98XgSzmlSLJr8vDNxX+uATGInlN97V3R+JpYWaSqn5IG3ewWgCwczk4bkOpgth/o8Nt5FOi4B4w0n/1A==" }, @@ -2906,11 +2955,12 @@ ], "bin": true }, - "vitest@5.0.2_@types+node@26.6.3_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0_jiti@2.7.0": { + "vitest@5.0.2_@types+node@26.6.3_@vitest+coverage-v8@5.0.2_jsdom@30.1.1_vite@8.3.1__@types+node@26.6.3__jiti@2.7.0": { "integrity": "sha512-7MQrx9pDv5aHiUcovIb/70Ys3tgtkUVgCtledvKdCmEO+/1Dicq5ZqoSxOW034m03oqC+oHOKui2dM6qtMLoJg==", "dependencies": [ "@types/chai", "@types/node", + "@vitest/coverage-v8", "@vitest/mocker", "chai", "es-module-lexer", @@ -2928,6 +2978,7 @@ ], "optionalPeers": [ "@types/node", + "@vitest/coverage-v8", "jsdom" ], "bin": true @@ -3037,6 +3088,7 @@ "npm:@types/react-dom@^19.3.0", "npm:@types/react@^19.3.0", "npm:@vitejs/plugin-react-swc@^4.3.3", + "npm:@vitest/coverage-v8@^5.0.2", "npm:emojibase-data@17.0.0", "npm:eslint-plugin-react-hooks@^7.1.1", "npm:eslint-plugin-react-refresh@~0.5.7", diff --git a/package.json b/package.json index e2d4437f..0af7038f 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@testing-library/user-event": "^14.6.7", "@types/node": "^26.6.3", "@types/react-dom": "^19.3.0", + "@vitest/coverage-v8": "^5.0.2", "eslint": "^10.11.0", "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-refresh": "^0.5.7", diff --git a/vitest.config.ts b/vitest.config.ts index af129dc0..1ae7d68c 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -14,6 +14,13 @@ export default mergeConfig( restoreMocks: true, unstubGlobals: true, css: false, + coverage: { + provider: "v8", + include: ["src/**/*.{ts,tsx}"], + exclude: ["src/test/**", "src/locales/**"], + reporter: ["text", "html", "lcov"], + reportsDirectory: "coverage/web", + }, }, }), );