Closed
Description
var assert = function() { };
assert.AssertionError = function (actual, expect) {
this.name = 'AssertionError';
this.actual = actual;
this.expected = expect;
}
Expected behavior:
No errors, and this: AssertionError
, and assert.AssertionError is a constructor function.
Actual behavior:
this: typeof assert
, which is a function, so that, for example this.name
tries to overwrite the built-in Function.name. Basically, assert.AssertionError
behaves like a static method of assert
instead of a static property that is a constructor function.
Note that usage of assert.AssertionError
works as desired: you can say new assert.AssertionError().actual
.