Update recommendation so that it is activated in the user profile.
This commit is contained in:
parent
2aea768281
commit
e448315e72
1 changed files with 65 additions and 62 deletions
127
README.org
127
README.org
|
@ -3,82 +3,85 @@
|
|||
This library does two things:
|
||||
1. Test output is pretty printed.
|
||||
2. Equality assertions are also diffed.
|
||||
|
||||
To use this library, include it in your dev profile:
|
||||
: [pjstadig/humane-test-output "0.6.0"]
|
||||
|
||||
|
||||
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 dev
|
||||
profile for your project:
|
||||
: (defproject foo/bar "0.1.0"
|
||||
: ...
|
||||
: :profiles {...
|
||||
: :dev {:injections [(require 'pjstadig.humane-test-output)
|
||||
: (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:
|
||||
|
||||
#+BEGIN_EXAMPLE
|
||||
{:user {:dependencies [[pjstadig/humane-test-output "0.6.0"]]
|
||||
:injections [(require 'pjstadig.humane-test-output)
|
||||
(pjstadig.humane-test-output/activate!)]}}
|
||||
#+END_EXAMPLE
|
||||
|
||||
This test output formatting works great with Emacs and when running Leiningen
|
||||
in a console. However, some IDEs are also bashing in their own versions of
|
||||
test formatting. 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.
|
||||
|
||||
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}))
|
||||
|
||||
#+BEGIN_EXAMPLE
|
||||
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}))
|
||||
#+END_EXAMPLE
|
||||
|
||||
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}))
|
||||
#+BEGIN_EXAMPLE
|
||||
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}))
|
||||
#+END_EXAMPLE
|
||||
|
||||
*BONUS FEATURE*
|
||||
|
||||
A test containing ~(is (= oops-i-only-gave-one-argument))~ will throw an exception.
|
||||
A test containing ~(is (= oops-i-only-gave-one-argument))~ will throw an
|
||||
exception.
|
||||
** 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.
|
||||
|
|
Loading…
Reference in a new issue