marick / Midje

Midje provides a migration path from clojure.test to a more flexible, readable, abstract, and gracious style of testing
MIT License
1.69k stars 128 forks source link

:fact-filter breaks on creation-time checking #380

Open totakke opened 7 years ago

totakke commented 7 years ago
(change-defaults :fact-filter (complement :slow))

in .midje.clj works when calling load-facts or running tests through lein-midje. The test ignores :slow facts as expected.

However, creation-time checking when loading a namespace does not ignore :slow facts.

rafaeldff commented 7 years ago

@totakke can you expand on what do you mean by creation-time checking?

totakke commented 7 years ago

@rafaeldff Sorry, creation-time checking means automatic checking just after ns loaded. For example, when there are the following tests

(fact "normal"
  0 => 1)

(fact :slow "slow"
  1 => 2)

on .midje.clj

(change-defaults :fact-filter (complement :slow))
$ lein midje #=> normal fact is tested
$ lein midje :filter slow #=> slow fact is tested

This is expected. But creation-time checking ignores .midje.clj, running both tests.

user=> (require 'example.t-core)
;; => normal and slow facts are tested

In my case, cider-refresh hanged because it triggered to run slow tests.

(change-defaults :check-after-creation false)

disables creation-time checking, but it disables lein midje too.

$ lein midje
No facts were checked. Is that what you wanted?

are these behaviors expected?