Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

no-expect-resolves.md 969B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Avoid using `expect().resolves` (`no-expect-resolves`)
  2. ## Deprecated
  3. This rule has been deprecated in favor of
  4. [`no-restricted-matchers`](no-restricted-matchers.md) with the following config:
  5. ```json
  6. {
  7. "rules": {
  8. "jest/no-restricted-matchers": [
  9. "error",
  10. { "resolves": "Use `expect(await promise)` instead." }
  11. ]
  12. }
  13. }
  14. ```
  15. ---
  16. Jest allows you to test a promise resolve value using `await expect().resolves`.
  17. For consistency and readability this rule bans `expect().resolves` in favor of
  18. `expect(await promise)`.
  19. ## Rule details
  20. This rule triggers a warning if `expect().resolves` is used.
  21. This rule is disabled by default.
  22. ### Default configuration
  23. The following patterns is considered warning:
  24. ```js
  25. test('some test', async () => {
  26. await expect(Promise.resolve(1)).resolves.toBe(1);
  27. });
  28. ```
  29. The following pattern is not considered warning:
  30. ```js
  31. test('some test', async () => {
  32. expect(await Promise.resolve(1)).toBe(1);
  33. });
  34. ```