I have a problem testing my application with jasmine-node and mocha (with zombie ). The angular point does not work with this test environment - when browser.visit "http://localhost:3000/" displays only the layout and does not display any link patterns. I think javascript doesn't run in the browser (I mean the zombie object) at all. My test Is there a way to make it work? Or is the problem different?
An error occurs in the jasmine spec that I copied from another spec project:
/home/alder/Node/angular-express-coffee/spec/app_spec.coffee:12 throw error; ^ ReferenceError: angular is not defined at /js/services.js:4:3 at /js/services.js:6:4 in /js/services.js
So, I think javascript is not working either.
Update: I am adding a debugging option and here that it displays:
➜ angular-express-coffee git:(master) ✗ mocha --require should --compilers coffee:coffee-script --colors -R spec --ui bdd Given I am a new user When I visit the home page Zombie: GET http://localhost:3000/newPost => 200 Zombie: GET http://localhost:3000/ => 200 Zombie: GET http://localhost:3000/js/lib/jquery-1.7.2.min.js => 200 Zombie: GET http://localhost:3000/js/lib/bootstrap.min.js => 200 Zombie: GET http://localhost:3000/js/lib/angular.min.js => 200 Zombie: GET http://localhost:3000/js/app.js => 200 Zombie: GET http://localhost:3000/js/controllers.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/controllers.js Zombie: GET http://localhost:3000/js/lib/jquery-1.7.2.min.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/lib/jquery-1.7.2.min.js Zombie: GET http://localhost:3000/js/filters.js => 200 Zombie: GET http://localhost:3000/js/directives.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/directives.js Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/filters.js Zombie: GET http://localhost:3000/js/lib/bootstrap.min.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/lib/bootstrap.min.js Zombie: GET http://localhost:3000/js/lib/angular.min.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/lib/angular.min.js Zombie: GET http://localhost:3000/js/services.js => 200 Zombie: GET http://localhost:3000/js/filters.js => 200 Zombie: GET http://localhost:3000/js/directives.js => 200 Zombie: GET http://localhost:3000/js/controllers.js => 200 Zombie: GET http://localhost:3000/js/app.js => 200 Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/app.js Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/controllers.js Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/directives.js Zombie: Unexpected token ILLEGAL SyntaxError: Unexpected token ILLEGAL in /js/filters.js Zombie: GET http://localhost:3000/js/services.js => 200
Maybe the problem is in coffeescript, but I had an option for mocha. And is there any method for testing angular applications without JsTestDriver distributed by the angular team.
Update. I changed the error statements to browser.errors.should.be.empty and it showed me the error:
1) Given I am a new user When I visit the home page Then browser status shold be ok: AssertionError: expected [ [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: Unexpected token ILLEGAL], [Error: angular is not defined] ] to be empty at Object.empty (/home/alder/Node/angular-express-coffee/node_modules/should/lib/should.js:229:10) at Context.<anonymous> (/home/alder/Node/angular-express-coffee/test/app_test.coffee:31:40) at Test.Runnable.run (/usr/lib/node_modules/mocha/lib/runnable.js:184:32) at Runner.runTest (/usr/lib/node_modules/mocha/lib/runner.js:300:10) at Runner.runTests.next (/usr/lib/node_modules/mocha/lib/runner.js:346:12) at next (/usr/lib/node_modules/mocha/lib/runner.js:228:14) at Runner.hooks (/usr/lib/node_modules/mocha/lib/runner.js:237:7) at next (/usr/lib/node_modules/mocha/lib/runner.js:185:23) at Runner.hook (/usr/lib/node_modules/mocha/lib/runner.js:205:5) at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Last update: The problem was in the asset pipeline, all js disabled for the zombie browser. Now I am switching to js from coffee and it works. But I prefer coffee, so if anyone can solve it, I will be grateful.