slagyr / speclj

pronounced "speckle": a TDD/BDD framework for Clojure.
MIT License
459 stars 58 forks source link

Running tests from REPL #119

Closed crisptrutski closed 9 years ago

crisptrutski commented 9 years ago

Perhaps I'm just doing something completely stupid - but trying to run a speclj suite in nrepl, and hitting pain as soon as I hit the (describe macro.

Have the standard (:require [speclj.core :refer :all] .. preamble, but then hit a series of turtles around unloaded namespaces: speclj.components, speclj.config, speclj.running.

Importing those into my namespace, I still hit an uninitialized speclj.runner/*runner* dyanmic var.

Running via the leiningen plugin is A-OK, but wondering if there is a way to compile and run tests via REPL (ie. would want to trigger directly from Cider).

(If not supported, would you take a PR to add it?)

crisptrutski commented 9 years ago

OK, so I found speclj.run.standard, and good to go. Suggest mentioning in the README though!

metametadata commented 9 years ago

I spent some time figuring out how to run the tests without leaving the REPL. (speclj.cli/run "--color" "<path to folder with tests>") worked for me.

+1 for updating the docs.

slagyr commented 9 years ago

First, I'll be happy to include some docs on the topic if you submit a pull request. I am a bit confused though, maybe because I don't typically run specs from the repo. But also because I just tried it out and it worked. What am I missing?

$ lein repl nREPL server started on port 51076 on host 127.0.0.1 - nrepl://127.0.0.1:51076 REPL-y 0.3.5, nREPL 0.2.6 Clojure 1.6.0 ...

user=> (require '[speclj.core :refer :all]) nil user=> (describe "foo" (it "blah" (should= 1 2)))

<Description Description: "foo">

user=> (run-specs) F

Failures:

1) foo blah Expected: 1 got: 2 (using =) user.clj:1

Finished in 0.00104 seconds 1 examples, 1 failures

<StandardRunner speclj.run.standard.StandardRunner@745b518a>

crisptrutski commented 9 years ago

Hey Micah - this issue was opened before the release of 3.2.0, and I see latest speclj.core now imports the same namespace I mentioned automatically (from 4162961eb717912951585e0849eb06ade501cc2a) - hence no more gotcha to document :)

slagyr commented 9 years ago

Nice. Thanks!