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

Inconsistency in the docs and the examples #3273

Closed
excitement-engineer opened this issue Apr 9, 2017 · 4 comments
Closed

Inconsistency in the docs and the examples #3273

excitement-engineer opened this issue Apr 9, 2017 · 4 comments
Milestone

Comments

@excitement-engineer
Copy link
Contributor

PR #3172 updated the docs to include the new .resolves and .rejects keywords for running assertions on Promises.

I noticed that this PR introduced some inconsistencies in the updated Error Handling section of https://github.com/facebook/jest/blob/master/docs/TutorialAsync.md. There is a screenshot of this section below:

screen shot 2017-04-09 at 09 11 46

  1. The comments at the top of the test still refer to try-catch, this is inconsistent with the code contained in the code snippets.
  2. The PR only shows an example with .rejects which will only be available in Jest 20+. This should be mentioned in the docs to avoid confusion.
  3. People using older versions of Jest will not be able to use this documentation. I think we should add back the explanation about using try-catch to catch Promise rejection (that was removed in PR Updated expect API docs with .resolves and .rejects #3172) for people using Jest 19 and below. This can live alongside the current docs using .rejects.
  4. The example contained in the link examples/async links to testing examples like this. These examples still use the try-catch mechanism, this is inconsistent with the code examples currently contained in the docs. This is another reasons why we should add back the explanation of using try-catch to this section of the docs.
@mainrs
Copy link

mainrs commented Apr 13, 2017

Is it possible to try out jest 20.0.0+ for those new keywords?

@excitement-engineer
Copy link
Contributor Author

I am not sure when jest 20 will be released but I hope soon:)

@cpojer
Copy link
Member

cpojer commented May 2, 2017

I think this is now resolved with #3201. If you think there is more we can do here, please send a PR :)

@cpojer cpojer closed this as completed May 2, 2017
@cpojer cpojer added this to the Jest 20 milestone May 2, 2017
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants