Closed olance closed 10 years ago
Seems the signature of the function has changed from assert.exception(callback[, type, message])
to assert.exception(callback[, matcher, message])
. So it is more flexible now. You can pass an object with which the error object must match or a function which is responsible to verify the error object. But it seems it isn't intended to support the feature of just passing the type of the error as string further. Unfortunately the documentation isn't changed yet.
@cjohansen, I think we should still support the feature of just passing the error type as string. I am not sure, but it seems the code block if (typeof matcher === "string") { ... }
is currently dead code. I think it was originally intended to provide the ability to pass a message without a matcher. If this is the case, we have to decide if we prefer the type matcher or the ability to pass a message without a matcher. I am for the type matcher.
For
assert.exception(callback[, type, message])
, the documentation states the following:However:
will pass.