daniellmb / angular-test-patterns

A High-Quality Guide for Testing Angular 1.x
MIT License
867 stars 100 forks source link

Mocha: expected [Function: wrapper] to throw an error #4

Open deedubbleyoo opened 10 years ago

deedubbleyoo commented 10 years ago

Hi,

When running the service test template through Karma, the error test fails, as it is not throwing an error.

I happen to be using Mocha (and have converted the matcher to:

expect(wrapper).to.throw('mySvc:  not provided');

Do you have any insight why the test might be failing?

daniellmb commented 10 years ago

That test pattern was added about a month ago SHA https://github.com/daniellmb/angular-test-patterns/commit/6562aa45bdf200fe4275347e9199ddf4a4c5b979#diff-3a53f5c03b03e7657006c210bf3d2149 I just ran through the Prepare your environment steps on a fresh clone of the repo and npm test ran without any errors. But that's using Jasmine, I would absolutely love to have AngularJS test patterns for Mocha/Chai but I need to stay focused on adding to the existing patterns before taking that on.

deedubbleyoo commented 10 years ago

I totally understand. We've found your test patterns immensely helpful with our project so please accept our thanks!

If I manage to work out what's going on (and assuming it's mocha related) I'll happily submit a PR with our mocha versions for you.

daniellmb commented 10 years ago

Sounds great, I'd be interested in what you find. I have a lot more patterns in the works to add, just not time to do it ;-)