Fork me on GitHub

Hello, Is there any way to configure dynamicaly a fixture? How do I pass information to use-fixtures to configure a file that will be used?


Make a function that returns a function. So you call (use-fixture :each (my-fixture config)) etc


Or don't use fixtures at all. Seriously, I never use fixtures because they are quite unpredictable in some situations - in general, I use a macro around the test with a try...finally for teardowns. Makes everything easier 🙂

👍 1

How do you find them unpredictable? They're certainly a bit suboptimal as implemented in Clojure just because they don't interact with ‘testing’ blocks in any useful way, but they've generally done what I expect, at least.


In async ClojureScript contexts, they behave strangely, for example; you can't evaluate test fragments like testing and make fixtures run; you're forced to use run-test or similar code (and these don't interact that well with ClojureScript also), and other small problems...


For Clojure, they do generally work, with the exception of losing the ability to evaluate test fragments and being forced to work with run-test and friends. But in ClojureScript, when you have async tests, most of the "core utilities to woth with tests" like with-redefs for example break down hard 😞

👆 1

Gotcha, interesting