core: improve message for assertion errors (throw assertion) #201

merged 2 commits into from Oct 23, 2013


None yet

4 participants

# create CustomError with prototype Error
fun = () -> throw new CustomError('test', true)

the above ends up showing an error message which is not useful at all (due to the Error instance being passed all the way to objDisplay) e.g.

AssertionError: expected [Function] to not throw an error but { Object (expected, found, ...) } was thrown

This PR, changes the message to e.g.

AssertionError: expected [Function] to not throw an error but 'CustomError: Expected x but found y' was thrown


I like the change but the travis build failed. Can you please check the logs and refactor any tests so this passes for all environments.


Coverage Status

Coverage remained the same when pulling e174212 on andreineculau:patch-1 into 4b51ea7 on chaijs:master.


Sorry, I wasn't thinking straight.
I updated all relevant code, and the necessary tests.

domenic commented Oct 23, 2013

From what I can tell of the tests, this change just replaces square brackets with single quotation marks. Why is that a good thing?

@logicalparadox logicalparadox merged commit 1a4d35d into chaijs:master Oct 23, 2013

1 check passed

default The Travis CI build passed

Thanks! Worked great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment