Skip to content

Instantly share code, notes, and snippets.

@abedra abedra/gist:384079
Created Apr 29, 2010

Embed
What would you like to do?
From 9f9636c75eb9b53b0bd30bb82b787da4cc753070 Mon Sep 17 00:00:00 2001
From: Aaron Bedra and Jon Distad <pair@thinkrelevance.com>
Date: Thu, 29 Apr 2010 14:56:23 -0400
Subject: [PATCH] exits with 1 when tests have failures or errors
---
src/leiningen/compile.clj | 2 +-
src/leiningen/test.clj | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/leiningen/compile.clj b/src/leiningen/compile.clj
index c36ab03..ae961a5 100644
--- a/src/leiningen/compile.clj
+++ b/src/leiningen/compile.clj
@@ -138,7 +138,7 @@
(.setValue (.createArg java) (prn-str form)))
;; to allow plugins and other tasks to customize
(when handler (handler java))
- (.execute java)))
+ (.executeJava java)))
(defn compile
"Ahead-of-time compile the project. Looks for all namespaces under src/
diff --git a/src/leiningen/test.clj b/src/leiningen/test.clj
index 19ea4b3..00d821e 100644
--- a/src/leiningen/test.clj
+++ b/src/leiningen/test.clj
@@ -22,7 +22,9 @@ each namespace and print an overall summary."
(println "\n\n--------------------\nTotal:")
(clojure.test/report summary#))
(when-not (= "1.5" (System/getProperty "java.specification.version"))
- (shutdown-agents)))))
+ (shutdown-agents))
+ (when-not (zero? (+ (:error summary#) (:fail summary#)))
+ (System/exit 1)))))
(defn test
"Run the project's tests. Accept a list of namespaces for which to run all
@@ -31,4 +33,5 @@ tests for. If none are given, runs them all."
(let [namespaces (if (empty? namespaces)
(find-namespaces-in-dir (file (:test-path project)))
(map symbol namespaces))]
- (eval-in-project project (form-for-testing-namespaces namespaces))))
+ (System/exit
+ (eval-in-project project (form-for-testing-namespaces namespaces)))))
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.