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

Code coverage as a bundle metric #263

Open
theKashey opened this issue Oct 22, 2021 · 3 comments
Open

Code coverage as a bundle metric #263

theKashey opened this issue Oct 22, 2021 · 3 comments

Comments

@theKashey
Copy link
Contributor

Two things:

  • while bundle size in most “visible” metric the main metric is the amount of code executed, not downloaded
  • ‘size-limit’ is not just “size control” utility, but “size discovery” as well

wondering, would this extra metric be useful, including usecase for creation solutions with less “boot time footprint”. The “code usage percentage” falls into the same bucket as “code size” and “execution time”, so it would not be that alien for size-limit functionality, however there is an open question how to make it actually usable and useful.

based on https://twitter.com/patak_js/status/1451440832347877377?s=21

@ai
Copy link
Owner

ai commented Oct 22, 2021

Any idea how to get this data?

@theKashey
Copy link
Contributor Author

According to Jest currently it can be done via:

probably offloading all this stuff to Istanbul is the best option.

@timocov
Copy link
Contributor

timocov commented May 20, 2023

I've implemented similar approach in tradingview/lightweight-charts#517 and I had the following idea in mind - the library provides isn't supposed to be working with tree-shaking (because we minified bundled code better than almost any consumer's minifier could do and because of library's API) so we wanted to make sure that the shipped code doesn't have any "dead" code in it. Thus I implemented a test to verify that:

In other (library-agnostic) words the algorithm was the following:

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

No branches or pull requests

3 participants