substantial / sinon-stub-promise

Synchronous Promise stubbing for Sinon.JS
MIT License
85 stars 11 forks source link

Handle when assertion error thrown in promise #6

Closed a-b-r-o-w-n closed 9 years ago

a-b-r-o-w-n commented 9 years ago

Found the culprit of chai-as-promised never failing. We need to handle AssertionError as a normal error an throw.

a-b-r-o-w-n commented 9 years ago

So it appears that there is a bug in that:

var AssertionError = require('assertion-error');
var ChaiAssertionError = require('chai').AssertionError;

var a = new AssertionError();
var c = new ChaiAssertionError();

a instanceof A #> true
c instanceof A #> false

c instanceof C #> true
a instanceof C #> false

In a real chai assertion, chai.AssertionError is thrown, not AssertionError. So this doesn't fix the issue yet.

amay commented 9 years ago

I'm happy. :dog2: