Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supertest augmented assert #3946

Merged
merged 3 commits into from
Oct 7, 2021
Merged

Supertest augmented assert #3946

merged 3 commits into from
Oct 7, 2021

Conversation

fnocetti
Copy link
Contributor

@fnocetti fnocetti commented Sep 30, 2021

This monkey-patches supertest to return useful messages on status code assertion failure.
Things to know:

  • There's no api to extend supertest (there is for superagent, but not useful for us)
  • Monkey patching is done in a non-exported module from the library. That means that should the implementation change, we may find issues.
  • The extension clears the stack trace from the error because it's not relevant and only adds noise. The stack trace comes from the moment the error is instantiated and that's not the place in which the validator runs, but supertest itself.
  • Since we import supertest in the tests right away, there's not intermediate module to execute the extension within. That said, the best place I found was the testingRoutes module.

PR checklist:

  • Update READ.me ?
  • Update API documentation ?

QA checklist:

  • Smoke test the functionality described in the issue
  • Test for side effects
  • UI responsiveness
  • Cross browser testing
  • Code review

@konzz konzz self-assigned this Oct 4, 2021
@konzz konzz force-pushed the supertest-augmented-assert branch from 37acb05 to 331a303 Compare October 7, 2021 14:41
@konzz konzz merged commit 5761084 into development Oct 7, 2021
@konzz konzz deleted the supertest-augmented-assert branch October 7, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants