I want to test my JS codes which uses jQuery by Jasmine in console with PhantomJS,
but ReferenceError: Can't find variable: $
I can test the codes by Jasmine in browser normally.
Thank you for your help.
$ phantomjs examples/run-jasmine.js http://localhost:8888/
ReferenceError: Can't find variable: $
http://localhost:8888/public/javascripts/PhotoTable.js:59
ReferenceError: Can't find variable: $
http://localhost:8888/public/javascripts/PhotoTable2.js:129
ReferenceError: Can't find variable: $
http://localhost:8888/public/javascripts/amenimomakezu.js:18
http://localhost:8888/public/javascripts/amenimomakezu.js:20
ReferenceError: Can't find variable: _error
http://localhost:8888/public/javascripts/p121106.js:29
http://localhost:8888/public/javascripts/p121106.js:39
null
Data loaded [object Object]
Data loaded [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Data loaded [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object]
Winter in October
[object Object]
[object Object]
'waitFor()' finished in 200ms.
Animal
Passing 20 specs
I ran into this problem also. I fixed it by changing my jasmine.yml to load jquery before it loads the rest of the javascript files:
src_files: - public/js/jquery.js - public/js/**/*.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With