From 6c1cfc9bfd00e0f36d9e4fffd9c69d6f90267e4b Mon Sep 17 00:00:00 2001 From: Bilal Khalid | DVM <126134030+drmbilalkhalid@users.noreply.github.com> Date: Tue, 11 Aug 2026 22:03:28 +0500 Subject: [PATCH 1/2] Update test coverage config for Vitest 4 --- src/content/5/en/part5c.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/content/5/en/part5c.md b/src/content/5/en/part5c.md index f671dc48e7b..61c38be6be9 100644 --- a/src/content/5/en/part5c.md +++ b/src/content/5/en/part5c.md @@ -806,6 +806,19 @@ The first time you run the command, Vitest will ask you if you want to install t ![terminal output of test coverage](../../images/5/18new.png) +With Vitest 4, only files covered by tests are included in the coverage +report by default. To also include uncovered source files, add the following +to the _test_ configuration in _vite.config.js_: + +```js +test: { + // ... + coverage: { + include: ['src/**/*.{js,jsx}'], + }, +}, +``` + A HTML report will be generated to the coverage directory. The report will tell us the lines of untested code in each component: From eeaacc7e909a560e61b092cf0c594f00ad1baf9a Mon Sep 17 00:00:00 2001 From: Matti Luukkainen Date: Sat, 22 Aug 2026 16:49:55 +0300 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/content/5/en/part5c.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/content/5/en/part5c.md b/src/content/5/en/part5c.md index 61c38be6be9..de1813e00c4 100644 --- a/src/content/5/en/part5c.md +++ b/src/content/5/en/part5c.md @@ -811,12 +811,13 @@ report by default. To also include uncovered source files, add the following to the _test_ configuration in _vite.config.js_: ```js -test: { +export default defineConfig({ // ... - coverage: { - include: ['src/**/*.{js,jsx}'], + test: { + // ... + coverage: { include: ['src/**/*.{js,jsx}'] }, }, -}, +}) ``` A HTML report will be generated to the coverage directory.