问题
I'm getting a strange problem, claiming that $ is not a function/is undefined. Obviously, this means that it thinks JQuery isn't defined, but if I view the source of the page and check requests, JQuery is definitely being pulled.
Total 0 tests (Passed: 0; Fails: 0; Errors: 0) (0.00 ms)
Firefox 8.0 Linux: Run 10 tests (Passed: 0; Fails: 0; Errors 10) (0.00 ms)
error loading file: /test/src/coffee.js:88: $ is not a function
My config file is as follows;
server: http://localhost:9876
timeout: 90
load:
- src/datejs.js
- src/jquery-1.6.4.js
- src/jquery-ui-1.8.16.custom.min.js
- src/jquery.ui.autocomplete.js
- src/jquery.jgrowl.js
- src/jquery.qtip.js
- src/typewatch.js
- src/tristate.js
- src/jquery.weekcalendar.js
- src/highcharts.js
- src/coffee.js
- # rest omitted for brevity...
Any help with this would be greatly appreciated. I've tried removing my JQuery entries in case they're overlapping with the ones in the version provided by JsTestDriver.
回答1:
I've sometimes run across issues using '$' (particularly in Drupal). Does replacing '$' with 'jQuery' have any effect?
回答2:
first of all you need to call jquery-1.6.4.js before datejs.js. then instead of $ user jQuery.
Hope it will work for you!
来源:https://stackoverflow.com/questions/8132158/jstestdriver-is-not-a-function