Home

Awesome

tmux-test

Build Status

A small framework for isolated testing of tmux plugins. Isolation is achieved by running the tests in Vagrant. Works on travis too.

Extracted from tmux plugin manager and tmux-copycat.

Dependencies: Vagrant (not required when running on travis).

Setup

Let's say you made tmux plugin with the following file hierarchy:

/tmux-plugin
|-- plugin.tmux
`-- scripts
    `-- plugin_script.sh

From your project root directory (tmux-plugin/) execute the following shell command to fetch tmux-test and add it as a submodule:

$ git submodule add https://github.com/tmux-plugins/tmux-test.git lib/tmux-test

Run the setup script:

$ lib/tmux-test/setup

The project directory will now look like this (additions have comments):

/tmux-plugin
|-- plugin.tmux
|-- run_tests                       # symlink, gitignored
|-- .gitignore                      # 2 lines appended to gitignore
|-- .travis.yml                     # added
|-- lib/tmux-test/                  # git submodule
|-- scripts
|   `-- plugin_script.sh
`-- tests                           # dir to put the tests in
    `-- run_tests_in_isolation.sh   # symlink, gitignored
    `-- helpers
        `-- helpers.sh              # symlinked bash helpers, gitignored

tmux-test is now set up. You are ok to commit the additions to the repo.

Writing and running tests

A test is any executable with a name starting with test_ in tests/ directory.

Now that you installed tmux-test let's create an example test.

Check out more example test scripts in this project's tests/ directory.

Continuous integration

The setup script (lib/tmux-test/setup) added a .travis.yml file to the project root. To setup continuous integration, just add/enable the project on travis.

Notes

Running tmux-test framework tests

tmux-test uses itself to test itself. To run framework tests:

Other goodies

License

MIT