Supertest should report custom error messages
See original GitHub issueAt the moment when the status message does not match the expectations we get an error message like:
"expected 200 "OK", got 500 "Internal server error"
It would be helpful to display a server custom error message if any, as defined by:
res.send(500, { error: 'something blew up' });
would display:
"expected 200 "OK", got 500 "something blew up"
Issue Analytics
- State:
- Created 10 years ago
- Reactions:10
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Supertest should report custom error messages #95 - GitHub
I think this should be a part of supertest. Fixing a bug in the code, where the test simply states the error was...
Read more >Is it possible to add information to the error message in supertest
I'd just like a little more information. For example: it('should successfully post my data and return a valid JSON', function( ...
Read more >Testing Error Handling in node.js | by Lars Trieloff
Here are four techniques I use to achieve consistently high test coverage and ensure my programs are not just working as expected, but...
Read more >How to use patch function in SuperTest - Javascript - Tabnine
Best JavaScript code snippets using supertest. ... it('should report error "User does not exist" when user does not exists', () => { return...
Read more >How To Implement Custom Error Responses in Express - Auth0
This is a brilliant idea to provide the caller with pathways to solutions and not just report error messages. Also, if something changes,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m feeling the same way. Its really non-descriptive to have the standard status code error. However this is a pretty simple work around when trying to the match status code:
👍 Please reopen
I think this should be a part of supertest. Fixing a bug in the code, where the test simply states the error was
500 Internal Server Error
is difficult. And it’s extra frustrating if you know your code is actually returning a meaningful error message.Others seem to feel the same way: https://github.com/frenchie4111/supertest/commit/850d5d893d313f4515a581c16cb173a74fd7b4f8 (supertest fork)