Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cljs.test instead of clojure.test throws a traceback #158

Closed
chr15m opened this issue Apr 7, 2022 · 10 comments
Closed

Using cljs.test instead of clojure.test throws a traceback #158

chr15m opened this issue Apr 7, 2022 · 10 comments

Comments

@chr15m
Copy link

chr15m commented Apr 7, 2022

version

0.3.2

platform

Ubuntu GNU/Linux, Node v16.13.1.

problem

If cljs.test is required the following error is thrown by nbb:

----- Error --------------------------------------
Message:  No namespace: cljs.test
No namespace: cljs.test

If clojure.test is required instead it works fine.

repro

In a .cljs file require cljs.test :refer-macros [is].

expected behavior

It should work the same as if clojure.test was required instead.

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

With 0.3.2:

user=> (require '[cljs.test :as t])
nil

Are you sure you are using 0.3.2?

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

Could you give a full standalone .cljs example here?

@chr15m
Copy link
Author

chr15m commented Apr 7, 2022

Ok, I think I figured out a repro, let me know if it works for you:

mkdir repro
cd repro
echo {} > package.json
npm i nbb@latest github:chr15m/sitefox#a76e045b
# create hello.cljs (see below)
npx nbb --classpath ${NODE_PATH:=./node_modules}/sitefox/src/ hello.cljs
(ns hello
  (:require
    [sitefox.ui :refer [log]]))

(log "hi")

Output I see:

----- Error --------------------------------------
Message:  No namespace: cljs.test
No namespace: cljs.test

(the referenced sitefox commit is the one still containing cljs.test requires)

@chr15m
Copy link
Author

chr15m commented Apr 7, 2022

I am not sure if it's related but this also throws:

(ns hello
  (:require
    [cljs.test :refer-macros [is]]))

(defn hello
  {:test (fn [] (is true false))}
  []
  (print "hello"))

(hello)

The error message I see when running with nbb is slightly different:

----- Error --------------------------------------
Message:  Could not resolve symbol: is
Phase:    analysis
Could not resolve symbol: is

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

That's a different error though? In nbb and also CLJS you can use :refer [is] but I'll support :refer-macros too, although that isn't strictly necessary for nbb.

@chr15m
Copy link
Author

chr15m commented Apr 7, 2022

Yes the second one is a different error. The first error above was the one I mentioned in chat.

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

Sorry for the confusion, I thought I was reading your first message because I clicked on that but then read your second message and skipped over the first

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

Strangely I can repro it like this, so that simplifies things:

(ns hello
  (:require
   [cljs.test :refer [is]]))

@borkdude
Copy link
Collaborator

borkdude commented Apr 7, 2022

Releasing as v0.3.3

@chr15m
Copy link
Author

chr15m commented Apr 8, 2022

Tested my failing cases and it works now thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants