geekjuice / vim-mocha

Run mocha specs from vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim-mocha

This is a lightweight Mocha runner for Vim. Extracted from vim-spec

Based off of Attamusc/vim-mocha and subsequently thoughtbot/vim-rspec.

Use both RSpec and Mocha? Take a look at vim-spec!

Installation

Using vundle:

Bundle 'geekjuice/vim-mocha'

If using zsh on OS X it may be necessary to run move /etc/zshenv to /etc/zshrc.

Using pathogen

cd ~/.vim/bundle
git clone git://github.com/geekjuice/vim-spec.git

Using vim-plug

Plug 'geekjuice/vim-mocha'

Example of key mappings

NOTE: The mappings have changed and use the same mappings as vim-rspec and vim-spec. If this is a big issue for you, open an issue and I'll re-add/add the namespace.

map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>

Configuration

Like thoughtbot/vim-rspec, the following variables can be overwritten for custom spec commands:

  • g:mocha_js_command
  • g:mocha_coffee_command

Examples:

let g:mocha_js_command = "!mocha --recursive --no-colors {spec}"
let g:mocha_coffee_command = "!mocha -b --compilers coffee:coffee-script{spec}"

" Using test runners
let g:mocha_coffee_command = "!cortado {spec}"

Note: cortado is a sugar wrapper for a more complex mocha call.

Notes

  • Allow configuration for mocha options i.e. --recursive, --reporter dot

  • BUG: Last nearest test fails if below it call

Credits

thoughtbot/vim-rspec

Attamusc/vim-mocha

License

mocha.vim is released under the MIT License.

About

Run mocha specs from vim

License:MIT License


Languages

Language:Vim Script 84.3%Language:Shell 11.5%Language:AppleScript 4.2%