This commit is contained in:
anseki
2017-02-10 17:17:39 +09:00
parent 137e7e94d3
commit ed23254865
2 changed files with 27 additions and 1 deletions

View File

@@ -28,7 +28,9 @@ getJasmineRequireObj().toThrowError = function(j$) {
return fail;
}
if (!(thrown instanceof Error)) {
// Get Error constructor of thrown
if (!thrown || !thrown.constructor || !thrown.constructor.constructor ||
!(thrown instanceof (thrown.constructor.constructor('return this')()).Error)) {
fail.message = function() { return 'Expected function to throw an Error, but it threw ' + j$.pp(thrown) + '.'; };
return fail;
}