Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Fix throws TypeError when passing an arrow function #186

Open
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 lib/ext/_assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function expectedException(actual, expected) {

if (Object.prototype.toString.call(expected) == "[object RegExp]") {
return expected.test(actual);
} else if (actual instanceof expected) {
} else if (expected.prototype && actual instanceof expected) {
return true;
} else if (expected.call({}, actual) === true) {
return true;
Expand Down
3 changes: 3 additions & 0 deletions 3 test/ext/assert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ describe("assert", function() {
);
threw = false;

// if passing a arrow function, catch all
assert.throws(makeBlock(thrower, TypeError), () => true);

// doesNotThrow should pass through all errors
try {
assert.doesNotThrow(makeBlock(thrower, TypeError), assert.AssertionError);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.