-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Not throw exception in when.js
then callback when assert fail.
#955
Comments
with the latest mocha, you just wanna return the promise |
for the sake of a bit more explanation... @taoyuan Your test will timeout because the call to In Mocha v1.20.1, this is my output:
As @jonathanong wrote, you want to simply return the promise instead of using it('should reject', function (done) {
var expected = 123;
var d = when.defer();
d.promise
.then(fail, function (err) {
assert.equal(err, 1); // should throw exception, but timeout
})
.then(done, done);
d.reject(expected);
}); |
@boneskull It's ok now. I run the test again using the old version In version
Now the same test in version Of cause, @boneskull gives the better way to test reject. Thanks. |
Using
when.js
for promise something, checking callback's parameter.Should throw exception, but throw timeout after 2000ms.
Using
buster
, it's work:Throw the proper exception:
The text was updated successfully, but these errors were encountered: