Skip to content

test: collect coverage from untested files too - #2239

Merged
ghostdevv merged 11 commits into
npmx-dev:mainfrom
AriPerkkio:test/coverage-includes
Jul 6, 2026
Merged

test: collect coverage from untested files too#2239
ghostdevv merged 11 commits into
npmx-dev:mainfrom
AriPerkkio:test/coverage-includes

Conversation

@AriPerkkio

@AriPerkkioAriPerkkio commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

(looks like everyone leaves this empty)

🧭 Context

Currently code coverage is not collected from untested files. You'll need to define coverage.include to instruct Vitest which files are considered as source files.

https://vitest.dev/guide/coverage.html#including-and-excluding-files-from-coverage-report

📚 Description

Defines source directories in coverage.includes with extensions of ts and vue.

This drops code coverage:

 ------------------------------------------------------------|---------|----------|---------|---------|
File | % Stmts | % Branch | % Funcs | % Lines |
------------------------------------------------------------|---------|----------|---------|---------|
- All files | 62.43 | 50.36 | 58.68 | 63.53 |+ All files | 48.50 | 42.03 | 46.77 | 48.81 |

@vercel

vercelBot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
docs.npmx.devReadyReadyPreview, CommentJul 6, 2026 12:17am
npmx.devReadyReadyPreview, CommentJul 6, 2026 12:17am
1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
npmx-lunariaIgnoredIgnoredJul 6, 2026 12:17am

Request Review

@coderabbitai

coderabbitaiBot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Updated vite.config.ts to adjust Vitest v8 coverage configuration: added an include filter {app,cli,server,shared}/**/*.{ts,vue} and retained the existing exclude filters **/node_modules/** and **/*.json. Coverage collection is now explicitly targeted to .ts and .vue files under the app, cli, server and shared directories.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly matches the main change: expanding coverage collection to include untested files.
Description check✅ PassedThe description is directly related to the coverage configuration change and explains the impact.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ghostdevvghostdevv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added the exclude as I think it should still be there? WDYT?

Also the CI has been failing, any ideas? If not I'll try and take a look soon 🙏 I'll mark as draft while we work on that, and then we can make it ready again when it's working!

@ghostdevv
ghostdevv marked this pull request as draft March 23, 2026 17:59
auto-merge was automatically disabled March 23, 2026 17:59

Pull request was converted to draft

@AriPerkkio

Copy link
Copy Markdown
ContributorAuthor

I re-added the exclude as I think it should still be there? WDYT?

*.json does not match the include glob's extensions (.ts, .vue) so it's not needed at all. Does app/, cli/, server/ or shared/ directories contain node_modules? 🤔

Also node_modules is always excluded so it doesn't need to be added. https://github.com/vitest-dev/vitest/blob/1f2d318493363855b66a22caaf7c1c10579029d5/packages/vitest/src/node/config/resolveConfig.ts#L497-L523

Also the CI has been failing, any ideas? If not I'll try and take a look soon 🙏 I'll mark as draft while we work on that, and then we can make it ready again when it's working!

No idea really. Tests should not fail based on collected coverage.

@ghostdevv

Copy link
Copy Markdown
Member

I re-added the exclude as I think it should still be there? WDYT?

*.json does not match the include glob's extensions (.ts, .vue) so it's not needed at all. Does app/, cli/, server/ or shared/ directories contain node_modules? 🤔

Also node_modules is always excluded so it doesn't need to be added. vitest-dev/vitest@1f2d318/packages/vitest/src/node/config/resolveConfig.ts#L497-L523

yeaaa you right, I kinda hoped it'd fix CI though 😆

Also the CI has been failing, any ideas? If not I'll try and take a look soon 🙏 I'll mark as draft while we work on that, and then we can make it ready again when it's working!

No idea really. Tests should not fail based on collected coverage.

🫠

@codecov

codecovBot commented Mar 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@github-actionsgithub-actionsBot added stale This has become stale and may be closed soon and removed stale This has become stale and may be closed soon labels Apr 28, 2026
@github-actionsgithub-actionsBot added stale This has become stale and may be closed soon and removed stale This has become stale and may be closed soon labels May 29, 2026
@github-actionsgithub-actionsBot added the stale This has become stale and may be closed soon label Jun 29, 2026
@ghostdevvghostdevv removed the stale This has become stale and may be closed soon label Jun 30, 2026

@ghostdevvghostdevv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to be working now, ty!

@ghostdevv
ghostdevv enabled auto-merge July 6, 2026 00:14
@ghostdevv
ghostdevv added this pull request to the merge queueJul 6, 2026
Merged via the queue into npmx-dev:main with commit ef6b240Jul 6, 2026
24 checks passed
@github-actions

Copy link
Copy Markdown

Thanks for your first contribution, @AriPerkkio! ✨

We'd love to welcome you to the npmx community. Come and say hi on Discord! And once you've joined, visit npmx.wamellow.com to claim the contributor role.

@github-actionsgithub-actionsBot mentioned this pull request Jul 6, 2026
ayo-run pushed a commit to ayo-run/npmx.dev that referenced this pull request Aug 5, 2026
Co-authored-by: Willow (GHOST) <git@willow.sh>
Co-authored-by: Philippe Serhal <philippe.serhal@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@AriPerkkio@ghostdevv@serhalp