From 092d513f01ad91cfa36eb5c20a67291bd895aebe Mon Sep 17 00:00:00 2001 From: Christian Fehmer Date: Sun, 11 Aug 2024 17:50:26 +0200 Subject: [PATCH] chore: fix test coverage not working with vitest workspaces (@fehmer) (#5764) --- package.json | 1 + pnpm-lock.yaml | 22 ++++++++++++++++++++++ vitest.config.js | 11 +++++++++++ 3 files changed, 34 insertions(+) create mode 100644 vitest.config.js diff --git a/package.json b/package.json index 2eb6ee6d40fc..90caf020601d 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "devDependencies": { "@commitlint/cli": "17.7.1", "@commitlint/config-conventional": "17.7.0", + "@vitest/coverage-v8": "1.6.0", "@monkeytype/release": "workspace:*", "conventional-changelog": "4.0.0", "husky": "8.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c82bd171e25e..2d9ccbb0e4a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: '@monkeytype/release': specifier: workspace:* version: link:packages/release + '@vitest/coverage-v8': + specifier: 1.6.0 + version: 1.6.0(vitest@1.6.0(@types/node@20.5.1)(happy-dom@13.4.1)(sass@1.70.0)(terser@5.31.3)) conventional-changelog: specifier: 4.0.0 version: 4.0.0 @@ -12188,6 +12191,25 @@ snapshots: transitivePeerDependencies: - supports-color + '@vitest/coverage-v8@1.6.0(vitest@1.6.0(@types/node@20.5.1)(happy-dom@13.4.1)(sass@1.70.0)(terser@5.31.3))': + dependencies: + '@ampproject/remapping': 2.3.0 + '@bcoe/v8-coverage': 0.2.3 + debug: 4.3.6(supports-color@5.5.0) + istanbul-lib-coverage: 3.2.2 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 5.0.6 + istanbul-reports: 3.1.7 + magic-string: 0.30.11 + magicast: 0.3.4 + picocolors: 1.0.1 + std-env: 3.7.0 + strip-literal: 2.1.0 + test-exclude: 6.0.0 + vitest: 1.6.0(@types/node@20.5.1)(happy-dom@13.4.1)(sass@1.70.0)(terser@5.31.3) + transitivePeerDependencies: + - supports-color + '@vitest/expect@1.6.0': dependencies: '@vitest/spy': 1.6.0 diff --git a/vitest.config.js b/vitest.config.js new file mode 100644 index 000000000000..82eb8ea19c95 --- /dev/null +++ b/vitest.config.js @@ -0,0 +1,11 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + coverage: { + enabled: true, + include: ["**/*.ts"], + reporter: ["json"], + }, + }, +});