I'm using node
0.8 with jasmine-node
, coffee-script
and backbone
in a project with this folder structure:
<project root>
` fares/
| ` base.coffee
| ` import.coffee
| ` import_list.coffee
` spec/
` fares/
` base.spec.coffee
` import_list.spec.coffee
And I have the weird situation of having green tests when calling from a specific folder and red tests from another.
If I run:
jasmine-node --coffee spec/fares/import_list.spec.coffee
The test passes. However, if I run the whole suite:
jasmine-node --coffee spec/
The test fails.
Check the failing logs where I console.log
ed the result of require "./import"
and found to be an empty object ({}
) rather than the Import class.
I don't know why this is happening, do you have any clue on this weird behavior? I appreciate your help, thank you.
I think you just are running into the fact that require in node.js uses relative path names, so an import will succeed from one directory and fail in another. it's the simplest problem but it trips me up all the time.
edit I did a closer re-read and I think probably you'll find there's a relative require of some kind going on inside jasmine-node itself. if you can kill the bug pls submit a pull req!