Comments (8)
This is a long time gone, but in case you or anyone needs to use the filter option in the future:
(bt/test :filters #{'(re-find #"^overmind\.test\..+-test$" (-> % meta :ns str))})
Basically, you were close @bsima, but you need to keep in mind that the value of %
is actually a Var in the namespace, not the namespace itself. You need to interrogate the metadata if you want to do any namespace comparison. The example above runs anything named *-test
in the overmind.test
namespace. If you want to debug the filter, you can add a print:
(bt/test :filters #{'(let [res (re-find #"^overmind\.test\..+-test$" (-> % meta :ns str))] (println res) res)})
Hope this helps!
from boot-test.
@bsima did you find your way to call -f
option? I ran in the same difficulty. Moreover I do not understand why test
task runs all namespaces when -n
is not set. I never saw a regular namespace containing tests, even if clojure allows it to test private symbols inside the namespace defining them. IMHO that choice made test
task non compatible with a TDD workflow. Could be better to have a [t dirs PATH #{str} "the test dirs"]
options for setting the directories containing tests?
from boot-test.
Is there similar support for :namespaces
? I don't want to manually type in my.namespace-test another.namespace-test a-third.namespace-test
when I want to run these, or have to add each and every namespace to a boot file. A lot of runners in other languages expose some sort of run-all --matching .*-test
regex support.
from boot-test.
Not sure I understand the question, @aft-luke. The example I provided is a regex on the entire
namespace, you can substitute it for your own. For your example, #"-test$"
should suffice.
from boot-test.
I think my problem is conceptual with how namespaces work in general. Coming from the javascript world, I would normally setup a test suite to allow me to invoke something like test ./some-feat/**/*-test.js
, where I could glob match on a particular feature or set of features. The purpose being the tests run much faster against only a handful of tests versus the whole suite. With clojure (cljs) namespaces, perhaps the files and dirs don't really matter, I could still just match on namespaces via {feature-name}.**.*-test$
or something similar?
from boot-test.
I could still just match on namespaces via {feature-name}.*.-test$ or something similar?
Essentially, yes.
What boot-test provides is actually much better because the idea of what is being run is divorced from the filesystem layout entirely. What the filter function receives is a Var
, which is a pointer to a named symbol somewhere. The Var also has metadata attached to it. Metadata is arbitrary, but part of what you get in a Var is its namespace--the ns
key (http://clojure.org/reference/namespaces).
If you want to run a particular namespace from the command line more easily, you could create a new Boot task that takes an argument ({feature-name}
in your example) then construct the regex to pass to test
in your task.
from boot-test.
I think the filter
task is a nice thing to have because of its flexibility and usefulness in complicated testing setups, but #21 should make it a lot easier to specify which tests should be run via a regex.
from boot-test.
Including/excluding namespaces by regex is now supported (#30). I think the filter
option is explained well in this issue, so this issue is OK to close.
from boot-test.
Related Issues (20)
- Change filter option
- using boot-test within a TDD workflow HOT 1
- Namespaces being tested multiple times
- Support option to opt out of terminating on any failures
- Support regexes for `:include` and `:exclude` terms HOT 7
- performance issue HOT 2
- option :junit-output-to must be of type str HOT 1
- Frequent java.lang.OutOfMemoryError: Metaspace
- selectors for tests HOT 3
- junit output-to support one single file HOT 2
- Test defined in cljx files are not recognized HOT 2
- test-ns-hook HOT 1
- Support dependency scopes
- Option to stop on first failure
- Does not find any tests HOT 4
- Separate test source path HOT 13
- Exception when test does not pass HOT 3
- Running a single test from namespace HOT 6
- Add support for clojure.test reporters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boot-test.