/undercover.el

A test coverage library for Emacs

Primary LanguageEmacs LispMIT LicenseMIT

undercover.el

Coverage Status Build Status license MELPA MELPA stable

A test coverage library for Emacs Lisp.

Notes

Few important notes about undercover.el:

  • it assumes a certain development cycle of your package (using Cask, Travis CI and Coveralls);
  • it doesn't support test coverage for byte-compiled files;
  • it based on edebug and can have some issues with macros coverage. It doesn't support Circular Objects.

Check out combined usage example and buttercup integration example for more information.

Installation

  • Add undercover.el to your Cask file:

    (source gnu)
    (source melpa)
    
    (package-file "awesome-package.el")
    
    (development
      (depends-on "undercover"))
  • Before load or require your package in test/test-helper.el or features/support/env.el (or analogue), call undercover with wildcards that will match package files:

    (when (require 'undercover nil t)
      (undercover "*.el" "awesome-extensions/*.el" (:exclude "awesome-examples.el")))
    
    (require 'awesome-package)
  • Add your repository to Coveralls.

Configuration

  • If you don't use Travis CI you need to set COVERALLS_REPO_TOKEN environment variable before running tests, for example:

    $ COVERALLS_REPO_TOKEN=<your-coveralls-repo-token> cask exec ert-runner
  • Set report-file option if you want to change report location:

    (undercover "*.el" (:report-file "/tmp/local-report.json"))

    undercover.el will try to merge new report with existing one.

  • Set send-report option to nil if you don't want to send coverage report:

    (undercover "*.el" (:report-file "/tmp/local-report.json") (:send-report nil))
  • Set UNDERCOVER_CONFIG if you want to configure undercover.el via environment variables:

    (when (require 'undercover nil t) (undercover))
    $ UNDERCOVER_CONFIG='("*.el" (:exclude "awesome-examples.el"))' cask exec ert-runner