balazsbotond / urlcat

A URL builder library for JavaScript.
https://urlcat.org
MIT License
1.82k stars 57 forks source link

Measure code coverage for TypeScript instead of JavaScript #39

Closed balazsbotond closed 3 years ago

balazsbotond commented 3 years ago

Our current method for measuring code coverage is rather limited. First, it works on the JavaScript output instead of the original TypeScript; second, it also measures coverage for the tests themselves. The only thing it should measure is src/index.ts. The output should be in LCOV format so we can feed it into coveralls.

I have created the current solution in a hurry; I have no time to dig deeper into how TS code coverage measurement works. I would love to learn from someone who is more experienced or simply just has the time to do this properly.

NOTE: please only work on this if you either have experience in this area or are willing to learn about it without much handholding and are able to produce a nice, clean solution.

Thank you!

praveen5959 commented 3 years ago

Do you mean generating a report of line coverage, branch coverage, etc . We can use jest for that right?

balazsbotond commented 3 years ago

We already measure code coverage but the configuration is less than optimal due to the problems I mentioned in the issue description. I don't know jest but it looks like it can generate coverage reports for TypeScript so it might be a good solution.

praveen5959 commented 3 years ago

So if your case is to generate a coverage HTML report then JEST can do it. I have worked on it also so I can help. image

P.S. The label should be Hacktoberfest to be counted I guess.

balazsbotond commented 3 years ago

An HTML report would be nice but the LCOV report is the main thing here, that's what gets fed to coveralls (as you can see in package.json).

Oh, I didn't know the label had to be capitalized. I'll rename it, thanks for pointing it out.

praveen5959 commented 3 years ago

JEST provides LCOV report itself in HTML report. DOCS reference: https://jestjs.io/docs/en/configuration#coveragereporters-arraystring--string-options

balazsbotond commented 3 years ago

Sounds great, thanks!

balazsbotond commented 3 years ago

I can't assign this issue to you on my phone but feel free to start working on it.

praveen5959 commented 3 years ago

Okay then I will start working on it and will keep you updated.

praveen5959 commented 3 years ago

Hey I checked your test configuration and now I am bit confused. You are already generating coverage in the form of HTML report.

image

So what's the exact issue?

balazsbotond commented 3 years ago

The exact issue is described in my first comment here.

praveen5959 commented 3 years ago

Oh I think I misunderstood it. I am sorry. I think you should keep the issue open so that others can also pitch meanwhile I will try n understand more. Sorry again.

balazsbotond commented 3 years ago

@praveen5959 It's ok, thank you for offering your help and looking into it :)

balazsbotond commented 3 years ago

To clarify: this issue is still open and we are still looking for someone who can help.

balazsbotond commented 3 years ago

Solved in #44. Closing.