README
Tertestrial Server
Runs the currently relevant test while coding.
Tertestrial runs configurable tasks on files or parts of files. Tasks are triggered by hotkeys from within your code editor, or automatically on file save, and run in a separate terminal window outside of your editor. A common application for this is running a particular unit test that is currently driving your development, i.e. which you want to make green, as part of test-driven development. With Tertestrial you can do this with an absolute minimum of key presses, distractions, slowdown from unnecessary test runs, and without having to leave your text editor.
Tertestrial works with all test frameworks and any text editor with a Tertestrial plugin. It comes with a set of built-in configurations for common frameworks that allow you to get started using it right away.
How it works
Tertestrial consists of a server (in this repository)
and a number of editor plugins.
The editor plugins send commands to the server
via a named pipe .tertestrial.tmp
in the directory where you start the server
(typically the base directory of the code base you are working on).
Tertestrial removes this pipe when stopping.
Installation
install Node.js version 4 or above
install the Tertestrial server:
npm i -g tertestrial
install the Tertestrial plugin for your editor
add
.tertestrial.tmp
to your global gitignore.
Creating a configuration file
To use Tertestrial with a code base,
run tertestrial setup
in the root directory of that code base.
This generates a configuration file
that tells Tertestrial
what to do with the different types of files in your project.
The setup script asks whether you want to use one of the built-in configurations
or make your own.
Built-in configurations
If you select a built-in configuration, you are done with the setup and can start using Tertestrial.
Custom configurations
Editor plugins send simple JSON-encoded messages that define what the user wants Tertestrial to do. What keys and values they contain depends on your use case, and how your editor plugin works. As an example, here are the messages sent by Tertestrial-Vim:
when the user wants to run the current action on the whole code base
{}
when the user wants to run the current action on the given file
{"filename": "foo.js"}
when the user wants to run the current action on the given line at the given file:
{"filename": "foo.js", "line": 3}
Tertestrial's configuration file (tertestrial.yml
)
defines how Tertestrial should handle these messages.
To do that, it defines a number of actions.
These actions consist of:
- a
match
block that has a structure comparable to commands, but with regular expressions as placeholders. An action must match an incoming message precisely in order to be run. Only the most specifically matching action is executed. - a
command
block that contains the console command that this action performs
Below is an example configuration file for JavaScript developers who use Mocha for unit testing and Cucumber-JS for end-to-end tests:
tertestrial.yml
actions:
# Here we define what to do with files that have the extension ".feature"
- match:
filename: '\.feature