Question

I'm trying to use the jasmine-jquery plugin: https://github.com/velesin/jasmine-jquery. In the documentation it says to:

Simply download jasmine-jquery.js from the downloads page and include it in your Jasmine's test runner file (or add it to jasmine.yml file if you're using Ruby with jasmine-gem). Remember to include also jQuery library as jasmine-jquery relies on it.

I'm trying to use this plugin to add fixtures to my jasmine tests in coffeescript for a coffeescript one page HTML5 canvas application. I'm using the jasmine-node version of jasmine to run my jasmine tests using node.js My issue with the above instructions is that I do not see a jasmine test runner file to edit, and as a result I'm unable to call methods from this plugin such as load_fixtures in my specs.

My current directory structure for the project is

coffescript/shape.coffee
index.html (An html file I would ideally like to use for my tests)
javascript/shape.js (The outputted coffeescript)
spec/shape.spec.coffee
spec/jasmine-jquery-1.3.1.js (The plugin)

Any insight is greatly appreciated as I've spent several hours trying to get this to work correctly. If you know a different test framework with fixtures that would be easier to setup for a coffeescript project that was also be welecomed. Thanks!

Was it helpful?

Solution

The library you are trying to use assumes that you are using jasmine in a html page. Neither it nor jquery will work with jasmine-node.

jQuery cannot work on node because it needs the browser's DOM api. There are some libraries that mock the DOM for node that might give you what you need.

OTHER TIPS

The test runner file you refer to is included in the standalone version of Jasmine (SpecRunner.html). It is not part of Jasmine-node.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top