• Stars
    star
    309
  • Rank 135,306 (Top 3 %)
  • Language
    Clojure
  • Created over 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Humane test output for clojure.test.

Humane test output for clojure.test

https://clojars.org/pjstadig/humane-test-output/latest-version.svg

This library does two things:

  1. Test output is pretty printed.
  2. Equality assertions are also diffed.

Version 0.8.0 and later of humane-test-output requires Clojure 1.8.0 or later.

IDEs

This test output formatting works great with Emacs and cider 0.10 or lower, and when running Leiningen in a console. However, some IDEs are also bashing in their own versions of test formatting.

I do not recommend using this with cider 0.11.0 or greater or with Cursive, or LightTable, or any other IDE.

Clojure

To activate it you will need to call pjstadig.humane-test-output/activate!. The preferred way to do this with Leiningen is to use an injection in the :user profile in your ~/.lein/profiles.clj:

{:user {:dependencies [[pjstadig/humane-test-output "0.11.0"]]
        :injections [(require 'pjstadig.humane-test-output)
                     (pjstadig.humane-test-output/activate!)]}}

If you are on a mixed team and some members need to disable humane test output, they can define the INHUMANE_TEST_OUTPUT environment variable, though again it’s better for each user to enable it in their own ~/.lein/profiles.clj.

Once humane-test-output is activated, instead of this:

FAIL in (a-test) (humane_test_output_test.clj:7)
FIXME, I fail.
 expected: (= {:foo :bar, :baz :quux, :something "a long string?", :another-key "and another value"} {:fo :bar, :baz :quux, :something "a long string?", :another-key "and another value"})
  actual: (not (= {:another-key "and another value", :foo :bar, :something "a long string?", :baz :quux} {:another-key "and another value", :something "a long string?", :fo :bar, :baz :quux}))

FAIL in (a-test) (humane_test_output_test.clj:11)
FIXME, I fail.
expected: (= {:foo :bar, :baz :quux} {:foo :bar, :baz :quux} {:fo :bar, :baz :quux})
  actual: (not (= {:foo :bar, :baz :quux} {:foo :bar, :baz :quux} {:fo :bar, :baz :quux}))
  FAIL in (a-test) (humane_test_output_test.clj:14)

FIXME, I fail.
expected: (list? foo)
  actual: (not (list? {:another-key "and another value", :foo :bar, :something "a long string?", :baz :quux}))

You get this:

FAIL in (a-test) (humane_test_output_test.clj:7)
FIXME, I fail.
expected: {:another-key "and another value",
           :foo :bar,
           :something "a long string?",
           :baz :quux}
  actual: {:fo :bar}
    diff: - {:baz :quux,
             :something "a long string?",
             :foo :bar,
             :another-key "and another value"}
          + {:fo :bar}

FAIL in (a-test) (humane_test_output_test.clj:10)
FIXME, I fail.
expected: {:foo :bar, :baz :quux}
  actual: {:fo :bar, :baz :quux}
    diff: - {:foo :bar}
          + {:fo :bar}

FAIL in (a-test) (humane_test_output_test.clj:13)
FIXME, I fail.
expected: (list? foo)
  actual: (not
           (list?
            {:another-key "and another value",
             :foo :bar,
             :something "a long string?",
             :baz :quux}))

BONUS FEATURE

A test containing (is (= oops-i-only-gave-one-argument)) will throw an exception.

ClojureScript

It is not necessary to activate humane-test-output with ClojureScript, but the behavior should be much the same as with Clojure.

License

Copyright Β© Paul Stadig and Outpace Systems, Inc.  All rights reserved.

Some small bits of code were taken from clojure.test and modified, and are
Copyright Β© Rich Hickey.  All rights reserved.

Distributed under the Eclipse Public License, the same as Clojure.

Acknowledgements

I am grateful for design and implementation assistance from Bryce Covert.

Thanks to Miloslav NenadΓ‘l for the ClojureScript implementation.

More Repositories

1

nio

Clojure support for java.nio.
Clojure
83
star
2

reducible-stream

Reducible stream for decoding data.
Clojure
37
star
3

utf8

Byte vector backed, utf8 strings for Clojure.
Clojure
29
star
4

assertions

Zero penalty runtime assertions for Clojure.
Clojure
24
star
5

rubyrdf

A Resource Description Framework (RDF) library for Ruby
Ruby
20
star
6

tim-clojure-1.0-snapshot

A Terracotta Integration Module for the Clojure language.
Java
16
star
7

deque-clojure

An implementation of Kaplan's and Tarjan's persistent deque.
Clojure
13
star
8

easy_imap

A simple interface to proccessing e-mail messages using IMAP, including handling multipart messages and attachments
JavaScript
11
star
9

polyfn

Open, single dispatch functions.
Clojure
8
star
10

scopes

A little library for resource scopes.
Clojure
7
star
11

procrustes

Metrics for your Clojure code.
Clojure
6
star
12

lein-maven-s3-wagon

A leiningen plugin for publishing to a private S3 maven repository.
Clojure
5
star
13

alice

A cryptographic library for Clojure using the Java Cryptography Architecture and Bouncy Castle.
Clojure
4
star
14

lein-metrics

Metrics for your Clojure code.
Clojure
4
star
15

es

A simple REST-based Elasticsearch client for Clojure.
Clojure
3
star
16

clojure-clojure

Clojure's abstractions written in Clojure
Clojure
2
star
17

tim-clojure-1.0.0

Terracotta Integration Module for Clojure 1.0
Java
2
star
18

scopes-magic

A little library for resource scopes. This is the magic part.
Clojure
2
star
19

new.dotfiles

Paul Stadig's dotfiles, lots of goodies originated here and elsewhere.
Python
2
star
20

conjecture

A clojure.test compatible third-party testing library for Clojure.
Clojure
2
star
21

ring-cider-debug

Establishes---in your development ring handler---thread local bindings necessary for CIDER debugging.
Clojure
2
star
22

lerna

Dynamo clustering for Lucene.
Clojure
2
star
23

yoke

A simple, pure Ruby pairing script for git.
1
star
24

laziness

Clojure
1
star
25

dominator

Emacs key bindings for Chrome
JavaScript
1
star
26

old.dotfiles

My dotfiles
Python
1
star
27

old.chef-repo

Ruby
1
star
28

old-chef-repo

My very own chef repo!!
Ruby
1
star
29

rep

A simplified Clojure REPL
Clojure
1
star
30

lein-fail-fast

Stop a testing run when the first test failure is received.
Clojure
1
star
31

pjstadig.github.com

1
star
32

dotfiles

My personal dotfiles.
Emacs Lisp
1
star