All Projects → Vimjas → Covimerage

Vimjas / Covimerage

Licence: mit
Generate coverage information for Vim scripts.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Covimerage

nvim-goc.lua
Go Coverage for Neovim
Stars: ✭ 17 (-58.54%)
Mutual labels:  coverage, neovim
Neoformat
✨ A (Neo)vim plugin for formatting code.
Stars: ✭ 977 (+2282.93%)
Mutual labels:  neovim
Sbt Ignore Play Generated
Configure linters and coverage tools to ignore Play's generated source files.
Stars: ✭ 10 (-75.61%)
Mutual labels:  coverage
Angular2 Webpack Boilerplate
A boilerplate for Angular 2 and Webpack
Stars: ✭ 30 (-26.83%)
Mutual labels:  coverage
Vim Gitgutter
A Vim plugin which shows git diff markers in the sign column and stages/previews/undoes hunks and partial hunks.
Stars: ✭ 7,364 (+17860.98%)
Mutual labels:  neovim
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (-19.51%)
Mutual labels:  neovim
Dotfiles
🔘 neovim, zsh, tmux, iTerm2, macOS dotfiles
Stars: ✭ 7 (-82.93%)
Mutual labels:  neovim
Vim.ana
The portable Vim IDE with all the trimmings, one-click installable on any standard box.
Stars: ✭ 37 (-9.76%)
Mutual labels:  neovim
Notational Fzf Vim
Notational velocity for vim.
Stars: ✭ 975 (+2278.05%)
Mutual labels:  neovim
Ale Sensible
Pretty, responsive and smooth defaults for a sane ALE, gets you started in 30 seconds
Stars: ✭ 30 (-26.83%)
Mutual labels:  neovim
Nvim Completion Manager
⚠️ PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
Stars: ✭ 950 (+2217.07%)
Mutual labels:  neovim
Dotfiles
`~/dotfiles` to setup my dev env on macOS based around `neovim` and `tmux`
Stars: ✭ 20 (-51.22%)
Mutual labels:  neovim
Vimrc
📝 Vim Configuration for nerds with vim-plug
Stars: ✭ 33 (-19.51%)
Mutual labels:  neovim
Coverme
Code coverage for Haxe
Stars: ✭ 11 (-73.17%)
Mutual labels:  coverage
Onehalf
Clean, vibrant and pleasing color schemes for Vim, Sublime Text, iTerm, gnome-terminal and more.
Stars: ✭ 974 (+2275.61%)
Mutual labels:  neovim
Dotfiles
My dotfiles.Managed with dotbot
Stars: ✭ 8 (-80.49%)
Mutual labels:  neovim
Rasusa
Randomly subsample sequencing reads to a specified coverage
Stars: ✭ 28 (-31.71%)
Mutual labels:  coverage
Arc Xcode Test Engine
An Xcode test engine for use with Phabricator's arc command line tool.
Stars: ✭ 31 (-24.39%)
Mutual labels:  coverage
Dotfiles
Configs 🤘🤘🤘
Stars: ✭ 39 (-4.88%)
Mutual labels:  neovim
Dotfiles
Get ready for dotfiles. Contains i3, i3blocks, rofi, dunst, picom, vim, tmux, and zsh.
Stars: ✭ 985 (+2302.44%)
Mutual labels:  neovim

covimerage

Generates code coverage information for Vim scripts.

It parses the output from Vim's :profile command, and generates data compatible with Coverage.py.

Build Status codecov Codacy Badge

Installation

You can install covimerage using pip:

pip install covimerage

Simple usage

You can use covimerage run to wrap the call to Neovim/Vim with necessary boilerplate:

covimerage run vim -Nu test/vimrc -c 'Vader! test/**'

This will write the file .coverage_covimerage by default (use --data-file to configure it), which is compatible with Coverage.py. A report is automatically generated (on stdout).

You can then call covimerage xml to create a coverage.xml file (Cobertura-compatible), which tools like Codecov's codecov tool can consume, e.g. via codecov -f coverage.xml.

Manual/advanced usage

1. Generate profile information for your Vim script(s)

You have to basically add the following to your tests vimrc:

profile start /tmp/vim-profile.txt
profile! file ./*

This makes Neovim/Vim then write a file with profiling information.

2. Call covimerage on the output file(s)

covimerage write_coverage /tmp/vim-profile.txt

This will create a file .coverage_covimerage (the default for --data-file), with entries marked for processing by a Coverage.py plugin (provided by covimerage)).

3. Include the covimerage plugin in .coveragerc

When using coverage on the generated output (data file), you need to add the covimerage plugin to the .coveragerc file (which Coverage.py uses). This is basically all the .coveragerc you will need, but you could use other settings here (for Coverage.py), e.g. to omit some files:

[run]
plugins = covimerage
data_file = .coverage_covimerage

4. Create the report(s)

You can now call e.g. coverage report -m, and you should be able to use coverage reporting platforms like https://codecov.io/ or https://coveralls.io, which are basically using coverage xml.

Reference implementation

Caveats

Coverage information for a function may get wiped if the function is re-defined after testing it. This is a known limitation that does not depend on the implementation of covimerage, but on the vim profiler itself, since profiling data for a function, used to extract coverage data, is reset when the function is re-defined, even if the definition is identical.

This can be an issue if the source files being checked for coverage are reloaded with runtime between tests for some reasons, e.g. when mocking some function. To prevent coverage information from being lost, one solution is to write such tests in a different suite that is run separately, and combine the coverage results with covimerage run --append.

Links

TODO

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].