Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding files with 100% coverage from the clearTextReporter #4690

Open
sebiniemann opened this issue Jan 28, 2024 · 2 comments · May be fixed by #4875
Open

Excluding files with 100% coverage from the clearTextReporter #4690

sebiniemann opened this issue Jan 28, 2024 · 2 comments · May be fixed by #4875
Labels
🚀 Feature request New feature request

Comments

@sebiniemann
Copy link

Is your feature request related to a problem? Please describe.
We adhere to a test policy mandating that all modifications made by developers to the source code reach 100% test coverage. While deviations are permissible, they must be clearly denoted through explicit exceptions in the form of corresponding comment blocks, which the test system recognizes.

To enforce this policy, we set the coverage threshold to 100% (utilizing thresholds: { break: 100 }). This ensures that every change is accompanied by either a test or a formally acknowledged deviation, as indicated by comments like // Stryker disable ....

When assessing our progress using the score table from the clear-text reporter, numerous rows with a 100.00 value in the score column are displayed, which makes it more difficult to find the file that still need to be worked on, especially with a large code base.

-----------|---------|----------|-----------|------------|----------|----------|
File       | % score | # killed | # timeout | # survived | # no cov | # errors |
-----------|---------|----------|-----------|------------|----------|----------|
All files  |   99.70 |      987 |         0 |          3 |        0 |        0 |
 file1.js  |  100.00 |       10 |         0 |          0 |        0 |        0 |
 file2.js  |   90.00 |        9 |         0 |          1 |        0 |        0 |
 file3.js  |  100.00 |       10 |         0 |          0 |        0 |        0 |
 ...       |     ... |      ... |       ... |        ... |      ... |      ... |
 file33.js |  100.00 |       10 |         0 |          0 |        0 |        0 |
 file34.js |   90.00 |        9 |         0 |          1 |        0 |        0 |
 file35.js |  100.00 |       10 |         0 |          0 |        0 |        0 |
 ...       |     ... |      ... |       ... |        ... |      ... |      ... |
 file97.js |  100.00 |       10 |         0 |          0 |        0 |        0 |
 file98.js |   90.00 |        9 |         0 |          1 |        0 |        0 |
 file99.js |  100.00 |       10 |         0 |          0 |        0 |        0 |
-----------|---------|----------|-----------|------------|----------|----------|

Describe the solution you'd like
Similar to the --skip-full option in https://github.com/bcoe/c8, an option to hide files with a perfect score in the clear-text reporter would be great.

Using this option should produce the following report compared to the example above:

-----------|---------|----------|-----------|------------|----------|----------|
File       | % score | # killed | # timeout | # survived | # no cov | # errors |
-----------|---------|----------|-----------|------------|----------|----------|
All files  |   90.00 |       27 |         0 |          3 |        0 |        0 |
 file2.js  |   90.00 |        9 |         0 |          1 |        0 |        0 |
 file34.js |   90.00 |        9 |         0 |          1 |        0 |        0 |
 file98.js |   90.00 |        9 |         0 |          1 |        0 |        0 |
-----------|---------|----------|-----------|------------|----------|----------|

We are open to contributing a merge request. 😃

An open question would be how you want to deal with the all files entry. Whether it should only refer to the displayed lines (as here), to all lines (as above), or not be displayed at all if the new option is used.

For us, each variant would be equally suitable, as this summary has no influence on our reviews.

@sebiniemann sebiniemann added the 🚀 Feature request New feature request label Jan 28, 2024
@nicojs
Copy link
Member

nicojs commented Mar 9, 2024

Hi @sebiniemann, and welcome. I'm sorry I didn't reply sooner. I've been quite busy and have yet to notice this issue sneaking in.

This sounds like an excellent new feature. It seems like a great addition to the clearTextReporter option. The name 'skip full' sounds good 👍.

An open question would be how you want to deal with the all files entry. Whether it should only refer to the displayed lines (as here), to all lines (as above), or not be displayed at all if the new option is used.

Ah yes. I would say the All files shouldn't be shown when all files result in a 100% score. And with that, we can also choose to not show the table at all in that case. What do you think?

@sebiniemann
Copy link
Author

And with that, we can also choose to not show the table at all in that case. What do you think?

Sounds good to me.

I've created a pull request (#4875) to implement this feature. I wasn't sure where you wanted these changes, so I've tried to be minimally invasive while covering everything mentioned -- excluding files with a 100% score, skipping "All files" and omitting the entire table if all files achieve a 100% score.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants