2012-11-26 75 views
11

我想測試我的JS代碼這在控制檯PhantomJS, 使用jQuery的茉莉花但ReferenceError: Can't find variable: $

我可以茉莉花測試代碼瀏覽器正常。

謝謝你的幫助。

$ 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 
+1

http://stackoverflow.com/questions/16156679/referenceerror-cant-find-variable-when-:我用它加載javascript文件的其餘部分之前改變了我的jasmine.yml負荷的jQuery固定它磨合jasmineheadlesswebkit – Ringo

回答

4

我也遇到了這個問題。

 
src_files: 
    - public/js/jquery.js 
    - public/js/**/*.js