Contents

Testing vim plugins

Short summary

  1. Write tests for your Vim plugin with vim-vspec.
  2. Declare dependencies of your Vim plugin as a flavorfile, and save it as Flavorfile in the root of your Vim plugin.
  3. Run vim-flavor test.

Long story

It is hard to test Vim plugins, because there are a few problems:

Therefore it is hard to do right testing for Vim plugins from scratch. As a lazy Vim user, I want to abstract all of the complexity.

Fortunately, the problems can be solved partially with vim-vspec, a testing framework for Vim script. It provides a DSL based on Vim script to write readable test code. It provides also a driver script to run tests. The driver script hides details about the isolation of Vim processes and 'runtimepath' configuration.

However, vim-vspec is a tool to write tests, not a tool to set up environment to test. So that it does nothing about dependencies. And it is painful to manage dependencies by hand. But it is easy with vim-flavor. The complexity can be hidden by combining both tools. That's why vim-flavor is integrated with vim-vspec.

Source: features/testing_vim_plugins/README.md at commit c0672d99, Vim Flavor (MIT license).