Skip to content

Add Config per Reporter#419

Merged
RobbieTheWagner merged 3 commits intoember-cli-code-coverage:masterfrom
gossi:reporter-config
Sep 20, 2024
Merged

Add Config per Reporter#419
RobbieTheWagner merged 3 commits intoember-cli-code-coverage:masterfrom
gossi:reporter-config

Conversation

@gossi
Copy link
Contributor

@gossi gossi commented Aug 14, 2024

I'm using codeclimate for my OSS projects. And for that to work, the code-coverage must be relative to repo-root, instead of project-root. This was easy done with the vitest project in there as it allowed to configure reports: https://vitest.dev/guide/reporters.html (it's also the same syntax that eslint uses to configure your rules).

In ember-cli-code-coverage, the config is always {} or "no config allowed". Now this PR adds support for the same config, that vitest allows.

I'm already using this with a patch on my OSS projects, here is one such PR pointed to the config.

It works, I can see my coverage on codeclimate and this PR brings back this support to everybody :)

@RobbieTheWagner
Copy link
Collaborator

This is great, thanks @gossi! I spent the last few days fighting with Istanbul and nyc trying to get all my paths to be the same and ultimately settled on just manually modifying them with sed. I think this might fix that issue?

Would it be possible to document a bit more about what projectRoot is or the use cases here? Like does projectRoot get prepended to the already determined paths? How is it different than passing cwd to the options etc

@gossi
Copy link
Contributor Author

gossi commented Aug 15, 2024

Thanks @RobbieTheWagner but I must confess, I only copy pasted things around to make my use-case work 🙈 In my project I was able to configure it for vitest, that worked and then I made it possible to have the same config for ember-cli-code-coverage, which then also made it work (I was happy to ignore how that worked and not question it). So the combo lcov + projectRoot is what people might likely be interested, so that's enough of a hint.

On the other hand it doesn't matter that much for that PR. Since this is very generic to have any options for any reporter. So it is up to consumers to figure out the options for each reporter.

@RobbieTheWagner RobbieTheWagner merged commit 332859c into ember-cli-code-coverage:master Sep 20, 2024
@RobbieTheWagner
Copy link
Collaborator

Thanks @gossi! I still think it would be nice to have some more docs about this and when to use it etc. but I do want to go ahead and get it in to unlock this.

@jrjohnson
Copy link

Just wanted to throw some thanks on this, I was searching for how to configure the projectRoot and am thrilled to see it's already here! 🤩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants