jcayzac
jcayzac8mo ago

Is there a way to get deno coverage information in a vscode lens?

If I run my tests with coverage enabled, can I get some visual feedback in vscode?
10 Replies
Deno AI Helper
Deno AI Helper8mo ago
I wasn't able to find the answer to your question in the official Deno documentation. As of my last update, there isn't a specific Deno feature or extension that provides test coverage information directly in VSCode as a CodeLens. However, if you're looking for visual feedback on your test coverage in VSCode, you might consider generating a coverage report using Deno's built-in coverage tools and then using a generic code coverage visualization tool that supports the output format provided by Deno. To generate a coverage report with Deno, you would typically run your tests with coverage enabled like this:
deno test --coverage=./coverage
deno test --coverage=./coverage
After running your tests, you can convert the coverage data to a more common format like lcov:
deno coverage ./coverage --lcov > coverage.lcov
deno coverage ./coverage --lcov > coverage.lcov
Then, you could use a VSCode extension that supports lcov reports, such as "Coverage Gutters", to visualize the coverage in your editor. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice and the compatibility of any VSCode extensions with Deno's coverage output.
jcayzac
jcayzac8mo ago
Code Coverage - Visual Studio Marketplace
Extension for Visual Studio Code - Boost test coverage and reliability with this easy-to-use code coverage analysis tool
jcayzac
jcayzac8mo ago
Hmmm… What does it mean that the highlighted line is missing coverage? It's just a closing brace.
No description
Joe Hildebrand
Joe Hildebrand8mo ago
That one probably means the else of that if wasn't covered. I think may be a couple off-by-ones in the coverage info, particularly around branches. I'll bet it's in the generated TS sourcemaps, but I can't prove it until I isolate some test cases.
jcayzac
jcayzac8mo ago
Thanks! I wish I could generate coverage when I run tests from the code lens…
Joe Hildebrand
Joe Hildebrand8mo ago
Me too. I also wish debugging was easier from there.
jcayzac
jcayzac8mo ago
Right. Debugging stuff in the js runtime of Deno was a nightmare tbh. I spent hours on a trivial issue I only found after I just injected debug information in the global scope so I could inspect things by running the generated deno binary…… (turns out object keys are always coerced to strings even if they're numbers, duh 😄 )
Joe Hildebrand
Joe Hildebrand8mo ago
(you almost certainly know this, but use a Map if you want numbers, and wait patiently for https://github.com/tc39/proposal-record-tuple so that both Map and Set are actually useful one day)
GitHub
GitHub - tc39/proposal-record-tuple: ECMAScript proposal for the Re...
ECMAScript proposal for the Record and Tuple value types. | Stage 2: it will change! - GitHub - tc39/proposal-record-tuple: ECMAScript proposal for the Record and Tuple value types. | Stage 2: it w...
bartlomieju
bartlomieju8mo ago
FYI @kt3k is investigating problems with coverage - there's something wrong with source maps being applied and that's why you see these strange uncovered lines Can you open an issue about it? Seems like adding an option to capture coverage from a code lens shouldn't be too hard Could you open an issue for that too? Debugging is really important to us, so if something is not easy to do we will address it
jcayzac
jcayzac8mo ago
Sure! https://github.com/denoland/vscode_deno/issues/1018 Which repo should I create that one in? The main repo, right? Edit: https://github.com/denoland/deno/issues/21652
More Posts
Performance QuestionI have a Deno application, which creates API endpoint, and uses mongodb. Now I want to host this on Is there a way to get a server's SSL certificate's public information with Deno?This is available in Node with `getPeerCertificate()` but not in Deno's Node compatibility layer - iInvalidData: No certificates found in cert fileHello! Following up from a previous help post here, https://discord.com/channels/684898665143206084/Cannot use deno prompt when in windows CMDIt only works in the VSCode integrated terminal? I have added some output around the run command, buStreaming large files with fetch and FormDataHi, I'm trying to find a way to build multiplart/form-data requests in Deno that contain large filesIf I want to integrate a fully featured Deno runtime into my application, where do I start?I want to create a scripting environment for my application that will enable people to create customTrying to deploy a project on Deno Deploy with a private Github repository dependencyBy reading the docs at https://docs.deno.com/runtime/manual/basics/modules/private I found that I caHow can I make sure the code gets run on the client-side??!```tsx import { useEffect, useState } from "preact/hooks"; export default function Callback() { VSCode + Deno + Vite + TypescriptJust setup a project with `create-vite-extra` but all the starter files are full of typescript errorMemory LimitHello guys, in some situations i'am receiving one of the following error message `dd-hard-memory-lim