the-bugging/istanbul-badges-readme

How to create multiple badges for README.md

oguzsh opened this issue · 6 comments

Hey!

I wanna create multiple coverage reports then I need two different markdown templates in README.md. How can I do that?

Example:

X Coverage Report Badges 

| Statements                                                               | Functions                                                                    | Lines                                                              | Code Quality                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-88.72%25-yellow.svg) | ![Functions](https://img.shields.io/badge/Coverage-91.94%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-89.2%25-yellow.svg) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/46159b0d28324e2485f32409d1b82960)](https://www.codacy.com?utm_source=gitlab.com&utm_medium=referral&utm_content=remoteteam/marketplace-core&utm_campaign=Badge_Grade) |

Y Coverage Report Badges

| Statements                                                               | Functions                                                                    | Lines                                                              | Code Quality                                                                                                                                                                                                                                  |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-88.72%25-yellow.svg) | ![Functions](https://img.shields.io/badge/Coverage-91.94%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-89.2%25-yellow.svg) | [![Codacy Badge](https://app.codacy.com/project/badge/Grade/46159b0d28324e2485f32409d1b82960)](https://www.codacy.com?utm_source=gitlab.com&utm_medium=referral&utm_content=remoteteam/marketplace-core&utm_campaign=Badge_Grade) |

Hi there @oguzsh thanks for the issue. By any chance, are those coverages from different projects, this, different coverage Istanbul reports? Currently it is not available to fulfill the README from different reports.

@venturalp so you see a way to achieve such thing?

@oguzsh please correct me if I got it wrong.

Same project but different coverage reports.

I got coverage1.json and coverage2.json files and I need to separate these reports in README.md file

Hmm as I feared. It's not possible as it is. Would you be so kind by thinking of a way and opening a PR having backwards compatibility in mind? We'll try to figure it out too.

Maybe I can combine these reports then I will have just one coverage report. But I am gonna think about how can i use different reports in just one README.md then create a PR.

Thanks for your answers!

@oguzsh did you manage to think of a way into achieving this behavior? I think we could be closing this issue.

Maybe, project can give multiple arguments in the command line then you can handle according to how many input file exists on args. When you take these inputs and add them to the array, you can create a template for every file coverage report. In this way, you can push these templates on a README.md file with one per newline space.

Example :
npm run istanbul-badges-readme -inputs file1.json file2.json --out covarage.final.json

This is just an idea I didn't code this feature at the moment coz I am so busy for now. But if you wanna handle this, you can 💯