I'm running test using mocha-phantomjs.
While running an unit test, I'm not running http server, so my resources are not available through absolute urls (eg: /static/images/face.png), and I'm getting following output:
% node_modules/mocha-phantomjs/bin/mocha-phantomjs test/runner/runner.html
test app.Main
✓ should show a command line
1 test complete (79 ms)
Error loading resource file:///static/images/face.png (203). Details: Error opening /static/images/face.png: No such file or directory
My test:
describe "test app.Main", ->
beforeEach ->
@app = App.Main()
React.renderComponent @app, root[0]
afterEach -> React.unmountComponentAtNode root[0]
it "should show a command line", ->
@cmdForm = root.find("div.header-block").first().find('form')
expect(@cmdForm.length).to.equal 1
expect(@cmdForm.find('div.select2-container ul.select2-choices').length).equal 1
The test succeed, but in the mean time I have this ugly error messages. How to configure phantomJS (or mocha?) to ignore loading that resources / not presenting this error messages?
You have to disable the loadImages default mocha-phantomjs -s loadImages=false