Trying to test some code that throws an exception with Mocha/Chai, but having no luck, here's the simple code I'm trying to test:
throw(new Error 'Oh no')
describe 'VisualizationsManager', ->
it 'does not permit the construction of new instances', ->
manager = new window.VisualizationsManager
Failure/Error: Oh no
It's probably because you are executing the function right away, so the test framework cannot handle the error.
Try something like:
If you know that you aren't using the
this keyword inside the function I guess you could also just pass
manager.test without binding it.
Also, your test name doesn't reflect what the code does. If it doesn't permet the construction of new instances,
manager = new window.VisualizationsManager should fail.