Jest code coverage in Neovim

Posted on Jun 28, 2022

I’ve been wanting to be able to view my code coverage directly within Vim for a long time. Not having to switch to browser or another window shortens the feedback loop, especially when developing a test for code you aren’t familiar with. Wallaby.js is a VSCode extension that handles this really well: it lets you run tests directly in the buffer and annotates lines with a green or red square to indicate if then statement was covered.

Well, as of today I’m happy to announce that you can have this in (Neo)vim as well!

You can download it here: https://github.com/Dkendal/nvim-coverage

Figure 1: Green highlight in the sign column is a covered statement, count is how many times it was covered. Red sign column is an uncovered statement. Black and yellow is an if path not taken. Yellow is an uncovered branch.

Figure 1: Green highlight in the sign column is a covered statement, count is how many times it was covered. Red sign column is an uncovered statement. Black and yellow is an if path not taken. Yellow is an uncovered branch.