Coder Social home page Coder Social logo

Comments (8)

tdavis avatar tdavis commented on July 19, 2024 1

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.

magomimmo avatar magomimmo commented on July 19, 2024

@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.

 avatar commented on July 19, 2024

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.

tdavis avatar tdavis commented on July 19, 2024

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.

 avatar commented on July 19, 2024

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.

tdavis avatar tdavis commented on July 19, 2024

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.

daveyarwood avatar daveyarwood commented on July 19, 2024

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.

daveyarwood avatar daveyarwood commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.