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

Error with preamble #91

Closed
ducky427 opened this issue Jan 19, 2015 · 4 comments
Closed

Error with preamble #91

ducky427 opened this issue Jan 19, 2015 · 4 comments

Comments

@ducky427
Copy link

Hello,
I am trying to add d3 to a preamble for testing. But if I do, my tests don't run.

I have created a minimal case which demonstrates my problem here. I have tried using both slimerjs and phantomjs to no success.

If I do lein cljsbuild test, I get this error:

Compiling ClojureScript.
Compiling "target/test.js" from ["src" "test"]...
Successfully compiled "target/test.js" in 2.312 seconds.
Running ClojureScript test: unit-tests
SyntaxError: Parse error

ReferenceError: Can't find variable: cemerick

ERROR: cemerick.cljs.test was not required.

You can resolve this issue by ensuring [cemerick.cljs.test] appears
in the :require clause of your test suite namespaces.
Also make sure that your build has actually included any test files.

Subprocess failed

If, however, I remove the preamble on line 31 in project.clj, tests do run. Output:

Compiling ClojureScript.
Running ClojureScript test: unit-tests

Testing d3test-test.core 

Ran 1  tests containing 1 assertions.
Testing complete: 0 failures, 0 errors.

I think that the error is due to the fact that d3 uses UTF-8 symbols like symbols for π, ε etc and runner.js doesn't seem to define a charset. But I am not sure.

Thanks

@ducky427
Copy link
Author

I looked into what runner.js was doing and I modified it locally to add <meta charset="utf-8"> to the head of the html generated. But still I got the same error when I ran phantomjs runner.js target/test.js

However when I opened up the generated html in firefox, and ran the command cemerick.cljs.test.run_all_tests() in the console, I got the tests to run.

Hope this helps.

@cemerick
Copy link
Owner

Thank you for the excellent testcase. Your repo tests properly when using clojurescript.test 0.3.2, fails with 0.3.3.

Some recent changes to the phantom/slimerjs test runner to eliminate security context warnings seem to cause another set of problems; here and #88.

I'll dig into it soon. Probably best to just use 0.3.2 in the meantime.

@ducky427
Copy link
Author

I tested my code with 0.3.2 and it works. Thanks for the suggestion! 👍

@cemerick
Copy link
Owner

Sorry for the troubles, but I've deprecated this project. Please see the notice at the top of the repo's README. This is a good thing, fundamentally. :-)

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