Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting Script Error in html reporter. #4

Closed
c4milo opened this issue Dec 19, 2011 · 5 comments
Closed

getting Script Error in html reporter. #4

c4milo opened this issue Dec 19, 2011 · 5 comments

Comments

@c4milo
Copy link

c4milo commented Dec 19, 2011

I might be doing something wrong. But I'm getting a "Script error" when my assertions fail.

Here are my specs
https://gist.github.com/1497704

I'm getting the following error in the development console:

Uncaught AssertionError: expected [ { code: '026',
    description: 'Resource not found.',
    httpCode: 404 } ] to be empty
@logicalparadox
Copy link
Member

Sorry it's giving your trouble... I have a few thoughts:

  • Make sure you are using chai v0.1.3 (released yesterday). It specifically dealt with an issue with error reporting and this could be a side effect.
  • Your should.be.empty() should actually be should.be.empty. The empty check is a getter, not a function.
  • You shouldn't require('chai'). To make is accessible to other test frameworks aside from mocha, when using it in the browser, it is on the global window object. Just do var should = chai.should() before your mocha.run().

And lastly. If all else fails, try the same tests using the expect interface. It is a nasty business extending Object.prototype in the browser, which is what the should interface does.

Let me know how it goes. If you have further trouble, please also include your browser and version so I can attempt to reproduce. Thanks, and good luck.

@c4milo
Copy link
Author

c4milo commented Dec 19, 2011

  • Make sure you are using chai v0.1.3 (released yesterday). It specifically dealt with an issue with error reporting and this could be a side effect. done
  • Your should.be.empty() should actually be should.be.empty. The empty check is a getter, not a function. done
  • ou shouldn't require('chai'). To make is accessible to other test frameworks aside from mocha, when using it in the browser, it is on the global window object. Just do var should = chai.should() before your mocha.run(). done

And lastly. If all else fails, try the same tests using the expect interface. It is a nasty business extending Object.prototype in the browser, which is what the should interface does. done

I'm still getting "Script error" though :/.

  • Browser version is Google Chrome 16.0.912.63
  • package.json dependencies
"dependencies": {
    "socket.io-client": "0.8.7", 
    "uglify-js": "1.1.0", 
    "chai": "0.1.3", 
    "mocha": "0.7.0"
  }

My runner.html and specs.js are looking like https://gist.github.com/1498083 now.

@logicalparadox
Copy link
Member

I have been able to duplicate this, however I don't think it is a problem with chai... I think it is mocha. Here is why...

I took chai completely out of the equation: https://gist.github.com/1498455

The async error will throw the "Script Error" in the console as well, even when not using swarm or chai.

I suggest opening an issue with mocha, and your welcome to reference this thread and gists as use case.

@tj
Copy link

tj commented Dec 19, 2011

oh weird wtf yeah i can reproduce this now. not sure when this was introduced, i'll fix it

@logicalparadox
Copy link
Member

Thanks...

See: mochajs/mocha#165

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants