Coder Social home page Coder Social logo

lein-difftest's Introduction

lein-difftest

lein-difftest is a Leiningen plugin for running clojure.test tests. It works exactly the same as “lein test” but with alternate test reporting. When a test fails, the report shows the diff of the actual and expected forms. When a test fails due to an error, stacktraces are cleaned up with clj-stacktrace.

If used as a plugin, Leiningen 1.2 or greater is required. It will work from the REPL with any version of Clojure.

Note: If your project depends on Clojure 1.2 but not Contrib 1.2 then you will need to add Contrib 1.2 as a dependency. clj-stacktrace depends on Contrib 1.1. This version of Contrib will be added to your project if you don’t already have a dependency on Contrib. Contrib 1.1 and Clojure 1.2 do not work together.

See It

The screenshot below shows two test runs. The first run shows the normal output when running lein test without this plugin. The second run shows output for the same tests after this library has been installed.

lein-difftest

The summary lines at the bottom are color coded: red means there was an error in one or more tests, yellow means that there were no errors but there were failures in one or more tests and green means that all tests pass.

Try It

If you would like to see a quick example of what test failures and errors look like, or if you would like to experiment with or improve this library, enter the following commands:


$ git clone git://github.com/brentonashworth/lein-difftest.git
$ cd lein-difftest
$ lein deps
$ lein test

All of the tests fail so that you may see examples of exceptions, and various diffs.

Leiningen Usage

Add [lein-difftest "1.2.2"] to your project’s :dev-dependencies.


$ lein deps
$ lein test

This plugin uses Robert Hooke to change the behavior of the Leiningen test task. If you want to go back to standard test output then you will need to remove this library from you classpath.

REPL Usage


user> (use 'difftest.core)
user> (test-ns 'some.test.namespace)

difftest.core/test-ns may be passed 0 or more namespaces. In the 0 case, it will run tests in the current namespace *ns*. Additionally, it will load or reload the namespaces that it is passed. Finally, it will disable the color feature as this does not look very nice in some REPLs. If you like color in the REPL then you can use difftest.core/run-tests.

Dependencies

Apart from Clojure, clojure.test and Leiningen, lein-difftest is built on top of other fine libraries:

License

Copyright © 2010 Brenton Ashworth

Distributed under the Eclipse Public License, the same as Clojure uses. See the file COPYING.

lein-difftest's People

Contributors

brentonashworth avatar

Stargazers

Paul Stadig avatar

Watchers

Paul Stadig avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.