no-expect-resolves.js 894 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _utils = require("./utils");
  7. var _default = (0, _utils.createRule)({
  8. name: __filename,
  9. meta: {
  10. docs: {
  11. category: 'Best Practices',
  12. description: 'Disallow expect.resolves',
  13. recommended: false
  14. },
  15. deprecated: true,
  16. replacedBy: ['no-restricted-matchers'],
  17. messages: {
  18. expectResolves: 'Use `expect(await promise)` instead.'
  19. },
  20. schema: [],
  21. type: 'suggestion'
  22. },
  23. defaultOptions: [],
  24. create: context => ({
  25. MemberExpression(node) {
  26. if ((0, _utils.isExpectCall)(node.object) && (0, _utils.isSupportedAccessor)(node.property, _utils.ModifierName.resolves)) {
  27. context.report({
  28. node: node.property,
  29. messageId: 'expectResolves'
  30. });
  31. }
  32. }
  33. })
  34. });
  35. exports.default = _default;