Code Monkey home page Code Monkey logo

Comments (6)

emezeske avatar emezeske commented on August 23, 2024

I've looked at this a little bit, and I'm not sure that I like the way Clojurescript One handles this. To me, the better solution would be to port the clojure.test library to clojurescript, and to write the crossover tests using the subset of clojure.test supported by both languages. As it stands, the Clojurescript One tests are a heavy mixture of Clojure and Clojurescript code, which is ugly, and would probably be a major turn-off for those people who plan to write 100% Clojurescript applications.

from lein-cljsbuild.

kumarshantanu avatar kumarshantanu commented on August 23, 2024

I agree with that, and I noticed your approach in supporting tests using assert is a good middle ground. Probably a portable version of clojure.test macros using assert would be useful. I am personally experimenting with assert – it appears something like the following in the ns macro in test files might be required:

(:use;*CLJSBUILD-REMOVE*;-macros
    [cljsbuild.test.macros;*CLJSBUILD-REMOVE*;-cljs
     :only [deftest is is-thrown testing]])

from lein-cljsbuild.

emezeske avatar emezeske commented on August 23, 2024

Hmm, your example makes sense to me; the macros would definitely have to be imported differently for CLJ/CLJS. I think the CLJSBUILD-REMOVE feature would in fact work, but it's pretty ugly. I'm noodling around on other possibilities at the moment for how to accomplish that in a nicer way, but I don't have any great ideas so far.

from lein-cljsbuild.

kumarshantanu avatar kumarshantanu commented on August 23, 2024

I made some progress running regular clojure.test tests in both Clojure and ClojureScript using the assert technique shown in the cljsbuild examples. The form (is (= ...)) works fine, but (is (thrown-wih-msg? ...)) has some problem still, mainly due to regex match (project-specific issue). It's difficult to trace the error when tests fail, but it's a good start.

https://github.com/kumarshantanu/basil (master, lein jst cljsbuild test)

from lein-cljsbuild.

kumarshantanu avatar kumarshantanu commented on August 23, 2024

I've factored out this idea (in a working form) into this library: https://github.com/kumarshantanu/clip-test

from lein-cljsbuild.

emezeske avatar emezeske commented on August 23, 2024

That's awesome. I'm going to close this case as it seems like you've taken care of it!

from lein-cljsbuild.

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.