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

docs: fix the example for test.fails function #1429

Merged
merged 1 commit into from Jun 4, 2022
Merged

docs: fix the example for test.fails function #1429

merged 1 commit into from Jun 4, 2022

Conversation

vasilii-kovalev
Copy link
Contributor

Link to the docs.

  1. The original example produces the following output to the console:
    image
  2. After changing the example according to the rejects assertion's description (adding await before expect and making the whole test asynchronous), the output to the console changes to this:
    image
  3. When changing test.fails to test, the output is the following:
    image

If I understand correctly, in the example the assertion throws an error, that a promise is resolved instead of being rejected, but since we use .fails function, vitest will mark the test as passed. If so, it seems the output of the fixed example (2) is correct.

If I understand the idea of test.fails incorrectly, I think it will be useful to leave a note in the dedicated discussion and/or in this pull request's comments.

@netlify
Copy link

netlify bot commented Jun 4, 2022

Deploy Preview for vitest-dev failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 73cfe1a
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/629b86ac77390a000b682055

@sheremet-va sheremet-va merged commit e8586ca into vitest-dev:main Jun 4, 2022
@vasilii-kovalev vasilii-kovalev deleted the fix-test-fails-example branch June 4, 2022 18:12
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.

None yet

2 participants