Test Elisp without the hoops
- Users starred: 26
- Users forked: 3
- Users watching: 26
- Updated at: 2020-02-24 19:30:12
Test Elisp with services like Travis CI without the fuss of Cask – just you, your project, and (Emacs-)Make. Designed to be used with GNU Make, EMake comes with no dependencies other than Emacs 25.
Things EMake does:
- parses, installs, and runs tests for your package
- provides all the power of Elisp to extend its capabilities on-demand
EMake will never introduce dependencies beyond Emacs.
Depending on your prefereces, you may find it advantageous to use Cask and EMake concurrently during project development, but I would recommend executing your tests with pure EMake to ensure consistency with CI testing.
In keeping with recent trends, what follows is a shell script to build the most recent version of EMake with minimal configuration.
bash <(curl -fsSL https://raw.githubusercontent.com/vermiculus/emake.el/master/new)
This does three things:
- Read the package’s basename interactively.
- Determine and download the latest version of EMake.
- Pin your EMake version to a newly-generated Makefile.
The script takes steps not to blow away an existing Makefile. It also avoids running on a CI server – for this use-case, you should pin your EMake version in your CI’s configuration file (see Using EMake).
- This is EMake. No other file is necessary to run EMake.
- This is a Makefile distributed with EMake that can drive
emake.elusing a bare minimum of configuration via environment variables. It makes certain assumptions about project setup that should be accurate for most projects. See the section dedicated to this file near the end of this documentation.
- This is a shell script that can build a minimal Emacs on Linux and macOS.
- This is an example project demonstrating the typical use of EMake.
Why use EMake?
EMake maintains a tight focus on continuous testing – there’s nothing included in the base script deemed unnecessary for this purpose. This focus removes complexity that can cause false failures in your testing (such as interactions with CI images, Python incompatibilities, etc.). This reduction of complexity naturally leads to a more stable build.
Free of dependencies, EMake is faster to install. In my own projects, switching from Cask to EMake reduced build time by 90 seconds down to an average installation time (everything after the container spin-up and before the tests run) to under three minutes. With caching facilities supported by some CI providers, installation is virtually instantaneous. While we surely shouldn’t be too concerned about some faceless VM’s time, we should be good stewards of the resources freely provided to us.
Because it relies only on existing tools, EMake is more pliable than
Cask (at least, more obviously so). Want to use an environment
variable to test MELPA-Stable separate from MELPA in your testing
matrix? Just configure an environment variable in the matrix itself
(or use any of Make’s facilities for more complicated logic). Want to
use an external testing framework? Just write an Elisp function with
declare form to indicate it as a handler.
Anything you want to – do it. Want to change the world? There’s nothing to it.