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

Identify what test covers what lines #523

Open
gaborbernat opened this issue Mar 12, 2024 · 1 comment
Open

Identify what test covers what lines #523

gaborbernat opened this issue Mar 12, 2024 · 1 comment

Comments

@gaborbernat
Copy link

Currently, there's no way to find out what tests are covering a given line, it would be nice to have this feature. In the Python language this is named dynamic contexts, see https://coverage.readthedocs.io/en/7.4.3/contexts.html#dynamic-contexts.

@ericmorand
Copy link

ericmorand commented Oct 26, 2024

That would require a dedicated runtime to support this. c8 is just running whatever is passed as argument. There is no way for it to know how a line was hit if this information is not given by the runtime itself (node, or v8 more specifically).

Also, even if it was possible, how would it be able to detect the test? Basically: what is a test?

  • foo.mjs
export const foo = () => 5;
  • index.mjs
import {foo} from "./foo";

foo();
c8 node index.mjs

foo.mjs is fully covered here. But what would be the test?

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

2 participants