Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9e8966d
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pom.xml | ||
*jar | ||
lib | ||
classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# lein-fail-fast | ||
|
||
Stop a testing run when the first test failure is received. | ||
|
||
This is especially useful in a build server situation where you don't need to | ||
finish out a test run once you know your tests have failed. | ||
|
||
## Usage | ||
|
||
Add as a development dependency to your lein project.clj, and turn on the | ||
LEIN_FAIL_FAST environment variable in your build environment. | ||
|
||
## Installation | ||
|
||
Add lein-fail-fast as a development dependency to your lein project.clj and | ||
robert-hooke as a non-dev dependency. | ||
|
||
## License | ||
|
||
Copyright (C) 2010 Paul Stadig | ||
|
||
Distributed under the Eclipse Public License, the same as Clojure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(defproject lein-fail-fast "1.0.0" | ||
:description "Stop a testing run when the first failure is received.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(ns leiningen.hooks.fail-fast | ||
(:use [robert.hooke] | ||
[leiningen.compile :only [eval-in-project]] | ||
[clojure.pprint :only [pprint]])) | ||
|
||
(defn wrap [form] | ||
`(do | ||
(add-hook | ||
#'clojure.test/do-report | ||
(fn [f# & args#] | ||
(let [result# (apply f# args#)] | ||
(when (contains? #{:fail :error} | ||
(:type (first args#))) | ||
(System/exit 0)) | ||
result#))) | ||
~form)) | ||
|
||
(defn fail-fast-hooke [f project form & [handler skip-auto init & args]] | ||
(apply f project (wrap form) handler skip-auto | ||
`(do (require 'clojure.test) | ||
(require 'robert.hooke) | ||
~init) | ||
args)) | ||
|
||
(if (System/getenv "LEIN_FAIL_FAST") | ||
(add-hook #'eval-in-project fail-fast-hooke)) |