Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Improve assertion messages in uncaught exceptions #172

Merged
merged 1 commit into from Oct 30, 2012

Conversation

Projects
None yet
2 participants
Contributor

danielbeardsley commented Oct 8, 2012

Wrap all assert.* methods in a try/catch that appends the
current test to the Error object and rethrows.

This allows us to get the corresponding Test object in the
uncaughtException event.

Before:

uncaught undefined: AssertionError: 'blah' === 'blahs'
 at Blah.<anonymous> (/home/user/test.js:15:17)
 ...

After:

test.js testing blah(): AssertionError: 'blah' === 'blahs'
 at Blah.<anonymous> (/home/user/test.js:15:17)
 ...
@danielbeardsley danielbeardsley Improve assertion messages in uncaught exceptions
Wrap all assert.* methods in a try/catch that appends the
current test to the Error object and rethrows.

This allows us to get the corresponding Test object in the
`uncaughtException` event.

Before:

   uncaught undefined: AssertionError: 'blah' === 'blahs'
    at Blah.<anonymous> (/home/user/test.js:15:17)
    ...

After:

   test.js testing blah(): AssertionError: 'blah' === 'blahs'
    at Blah.<anonymous> (/home/user/test.js:15:17)
    ...
fc43ba6

@ghost ghost assigned deralex Oct 18, 2012

@deralex deralex pushed a commit that referenced this pull request Oct 30, 2012

Alexander Kluth Merge pull request #172 from danielbeardsley/good-errors-for-async-as…
…serts

Improve assertion messages in uncaught exceptions
f6e29e1

@deralex deralex merged commit f6e29e1 into visionmedia:master Oct 30, 2012

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