diff options
author | Chris Knight <cknight1234@gmail.com> | 2020-03-09 21:46:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 17:46:55 -0400 |
commit | 2115b38fef654c2d7c5998f40967fcfe39d7c515 (patch) | |
tree | d99556d76ffffefc28a58b4d42115dfcd7ad8c8f /std/testing/asserts.ts | |
parent | 7f591c37835be55b8a426cca61e677fd62c23c93 (diff) |
test: add actual error class to fail message (#4305)
Diffstat (limited to 'std/testing/asserts.ts')
-rw-r--r-- | std/testing/asserts.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts index d562447c8..1c6dfff19 100644 --- a/std/testing/asserts.ts +++ b/std/testing/asserts.ts @@ -315,9 +315,9 @@ export function assertThrows( fn(); } catch (e) { if (ErrorClass && !(Object.getPrototypeOf(e) === ErrorClass.prototype)) { - msg = `Expected error to be instance of "${ErrorClass.name}"${ - msg ? `: ${msg}` : "." - }`; + msg = `Expected error to be instance of "${ErrorClass.name}", but was "${ + e.constructor.name + }"${msg ? `: ${msg}` : "."}`; throw new AssertionError(msg); } if (msgIncludes && !e.message.includes(msgIncludes)) { |