Code Monkey home page Code Monkey logo

istanbul.vim's Introduction

istanbul.vim

istanbul.vim

Visualize code coverage and summarize uncovered lines into quickfix by reading coverage.json

Currently, the following JSON output are confirmed:

100% Vim Script:sparkles: Works on Linux, Windows, and Mac OS, including non-Python(-python) and non-Ruby(-ruby) environments.

Requirements

Install (Pathogen)

git clone https://github.com/retorillo/istanbul.vim.git ~/.vim/bundle/istanbul.vim

# Only for Vim < 7.4.1304
git clone https://github.com/retorillo/json-ponyfill.vim.git ~/.vim/bundle/json-ponyfill.vim

Commands

IstanbulUpdate

Update signs of current buffer and summarize uncovered lines into quickfix/location-list by reading coverage.json,

:view index.js | !npm test | IstanbulUpdate

By default, IstanbulUpdate continues to find coverage/coverage.json or coverage/coverage-final.json from current buffer's parent directory(%:h) until the root(/ for Linux, <Drive>:\ or \\<Server>\ for Windows).

To change this search pattern, set g:istanbul#jsonPath.

let g:istanbul#jsonPath = ['coverage/custom.json', 'coverage/coverage.json']

Or, execute with existing JSON path.

IstanbulUpdate coverage/custom.json

Uncovered lines are stored to quickfix by default, use let g:istanbul#store = 'location-list' to change store. See :help quickfix and :help location-list.

Default mode is line coverage, can change mode by using IstanbulMode.

IstanbulMode

Change or toggle mode of coverage information of current buffer. Now supports the following modes:

  • line (gathered information from statementMap and fnMap)
  • branch (gathered information from branchMap)
" Toggle between line and branch coverage
:IstanbulMode
" Change to line coverage
:IstanbulMode line
" Change to branch coverage
:IstanbulMode branch

IstanbulNext, IstanbulBack

Jump to N-th next/previous head of uncovered region.

Basically this plugin use quickfix/location-list, so can use its commands to jump. (eg. :cc, :cn, :cp )

But, :IstanbulNext and :IstanbulBack allows to jump to only entry about coverage, and useful when quickfix/location-list is dirty. (eg. after :vimgrepadd)

Without bang(!), never jump to another buffer. This rule is same as :cc, see :help :cc.

When reached end of buffer, by default, jump cyclically without error. To change this behavior, execute let g:istanbul#jumpStrategy = 'linear'

" Jump to next uncoveraged range
:IstanbulNext
" Jump to 12th uncovered range
:12 IstanbulNext
" Same as above
:IstanbulNext 12
" Same as above, but may jump to another buffer
:IstanbulNext! 12

" Jump to previous uncoveraged range
:IstanbulBack
" Jump to N-th previous uncoveraged range
:12 IstanbulNext
" Same as above
:IstanbulNext 12
" Same as above, but may jump to another buffer
:IstanbulNext! 12

IstanbulClear

Clear all signs of current buffer.

If IstanbulClear is called with bang(!), also remove Istanbul entries from quickfix/location-list on current buffer.

" Only clear signs
:IstanbulClear
" Clear signs and quickfix/location-list
:IstanbulClear!

IstanbulToggle

Toggle between :IstanbulUpdate and :IstanbulClear! by keeping its mode and specified JSON path.

Unit testing for this plugin script (For plugin developers)

test/test.vim is a useful snipet to verify working of autoload scripts.

: view README.md | view test/test.vim | let g:istanbul#test = 1 | source test/test.vim
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
" This test requires at least two valid buffers

License

MIT License

Copyright (C) 2016-2017 Retorillo

istanbul.vim's People

Contributors

aklt avatar retorillo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aklt basilgood

istanbul.vim's Issues

Implement IstanbulToggle

Switches between doing what IstanbulUpdate and IstanbulClear.
To restore by toggling, specified JSON path and mode should be kept even if cleared.

See also: bug #8

From: #7 (comment)

[INFO] - Explanation of numbers / signs?

The blue-on-white numbers used as signs beside covered lines of code are not explained. Does a line with "01" next to it differ in any significant way from a line with "04" or "06" next to it?

If so, could this be documented somewhere?

If not, what do these numbers mean? Can they be suppressed (so that only the red signs for uncovered lines are shown)?

Thank you for this plugin!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.