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

Report test coverage of statements and branches #7100

Open
Tracked by #1
jakeboone02 opened this issue Nov 14, 2023 · 0 comments
Open
Tracked by #1

Report test coverage of statements and branches #7100

jakeboone02 opened this issue Nov 14, 2023 · 0 comments
Labels
enhancement New feature or request jest Something related to the `bun test` runner

Comments

@jakeboone02
Copy link
Contributor

jakeboone02 commented Nov 14, 2023

What is the problem this feature would solve?

bun test --coverage reports coverage percentages for functions and lines like Jest/Vitest/etc, but those also report coverage for statements and branches.

More granular reporting like this is especially helpful to ensure full coverage on terse code like chained ternaries, for example.

const chainedTernary =
  condition === 1
    ? result1
    : condition === 2
      ? result2
      : result3;

I realize this type of code isn't everyone's cup of tea, but it would be really nice to get the statement and branch coverage numbers from Bun.

What is the feature you are proposing to solve the problem?

Include statement and branch coverage percentages in bun test --coverage reports. Something like this in the CLI:

---------------|---------|---------|---------|---------|-------------------
File           | % Funcs | % Lines | % Stmts | % Brnch | Uncovered Line #s
---------------|---------|---------|---------|---------|-------------------
All files      |  100.00 |  100.00 |   90.00 |   80.00 |
 src/index.ts  |  100.00 |  100.00 |   90.00 |   80.00 | 25,50
---------------|---------|---------|---------|---------|-------------------

                                   ^^^^^^^^^^^^^^^^^^^^

I assume this would affect the lcov output as well (see #4015).

What alternatives have you considered?

Sticking with Jest for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jest Something related to the `bun test` runner
Projects
None yet
Development

No branches or pull requests

2 participants