-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
feature-request: first-class test-coverage support #106
Comments
CC: @schuay, @TimothyGu, @addaleax |
other references: From nodejs/node
|
This is really interesting, and bothered me how we would try to accomplish this. Great reminder of the capabilities of V8. We would need to take the coverage information and for transpiled modules, remap via the source maps. We have the logic in Rust to deal with the source maps and so it should be workable. I assume we would want to output a |
@kitsonk see https://github.com/bcoe/c8, which can turn raw v8 output into Istanbul reports. |
Thinking about this after a while. We need a few things:
|
FYI Rome seems doing something similar on their own. https://github.com/facebookexperimental/rome/blob/master/packages/%40romejs/v8/CoverageCollector.ts |
I tentatively started working on this issue - managed to get coverage data when running First #4780 must be fixed; secondly data from V8 must be parsed into human readable form. I like approach that |
Istanbul/nyc would have the most wide support. It is the defacto standard, and it would mean not having to reinvent the wheel. Output of a istanbul format would integrate into a lot of existing toolchains. Even if we incorporate an integrated output (again I would just leverage nyc's logic) we should still output the raw JSON. Why invent our "own" solution? |
Partly unrelated, but people in this thread might be interested to know λ d8 --lcov=coverage.info Ankara/coverage-test.mjs
λ cat coverage.info
SF:/Users/john/Desktop/Ankara/coverage-test.mjs
FN:1,
FNDA:1,
DA:1,1
DA:2,1
end_of_record
SF:/Users/john/Desktop/Ankara/foo.mjs
FN:1,
FNDA:1,
FN:1,foo
FNDA:1,foo
DA:1,1
DA:2,1
DA:3,1
⋮ This is a feature of V8's debugging shell (and not the engine itself), though it probably wouldn't be difficult to integrate into the runtime ( In any case, this isn't documented in |
A recent attempt by Bartek https://github.com/denoland/deno/pull/4802/files |
@kitsonk wondering if there are any updates on coverage functionality exposed from Deno? Thanks! |
No. There are big reactors in the internals at the moment which make this something that would need to come afterwards. |
Thanks @kitsonk anxiously awaiting... |
I find code-coverage is an extremely valuable tool for ensuring that a codebase is well tested. It's also a great way to figure out performance bottlenecks.
newer versions of v8 have built in code coverage, through the inspector API:
https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
It would be really nice if we could figure out a way to expose this functionality out of the gate in deno, with source-map support; something I've been trying to do retroactively in Node.js.
The text was updated successfully, but these errors were encountered: