I am writing a node.js app in coffee-script using the express framework. After exploring a couple of options I finally decided to use mocha and zombie.js. However, I am having a hard testing the UI. For example, to implement a successful user authentication I do the following: see the code pasted here my_gist
What I really wanted to do is the following:
- call
get '/sessions/new'
, which will call the SessionsController and display the authentication form - then I'll call the
browser.visit
method, enter the values for the fields and submit the form, which will generate a post method if the username and password are correct, I'll expect the SessionsController to react accordingly and redirect to the right page. Unfortunately, whenever I run the tests it complains about
Zombie: require is not defined ReferenceError: require is not defined
. It turns out it doesn't like the two lines in my /javascripts/app.jsrequire("coffee-script") require('./tfs.coffee')
Even when I try to extract any information from the browser after the visit method, I just get undefined values. Apparently none of my assertions is being tested. It just passes the test. Is there anything I am doing wrong? Has anyone testing coffee-script written app in express using Zombie.js faced that problem? what could be the fix?