eslint-plugin-jest 28.11.1 → 28.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ var _default = exports.default = (0, _utils.createRule)({
15
15
  description: 'Disallow commented out tests'
16
16
  },
17
17
  messages: {
18
- commentedTests: 'Some tests seem to be commented'
18
+ commentedTests: 'Do not comment out tests'
19
19
  },
20
20
  schema: [],
21
21
  type: 'suggestion'
@@ -13,30 +13,20 @@ var _default = exports.default = (0, _utils.createRule)({
13
13
  },
14
14
  messages: {
15
15
  missingFunction: 'Test is missing function argument',
16
- pending: 'Call to pending()',
17
- pendingSuite: 'Call to pending() within test suite',
18
- pendingTest: 'Call to pending() within test',
19
- disabledSuite: 'Disabled test suite',
20
- disabledTest: 'Disabled test'
16
+ skippedTest: 'Tests should not be skipped'
21
17
  },
22
18
  schema: [],
23
19
  type: 'suggestion'
24
20
  },
25
21
  defaultOptions: [],
26
22
  create(context) {
27
- let suiteDepth = 0;
28
- let testDepth = 0;
29
23
  return {
30
24
  CallExpression(node) {
31
25
  const jestFnCall = (0, _utils.parseJestFnCall)(node, context);
32
26
  if (!jestFnCall) {
33
27
  return;
34
28
  }
35
- if (jestFnCall.type === 'describe') {
36
- suiteDepth++;
37
- }
38
29
  if (jestFnCall.type === 'test') {
39
- testDepth++;
40
30
  if (node.arguments.length < 2 && jestFnCall.members.every(s => (0, _utils.getAccessorValue)(s) !== 'todo')) {
41
31
  context.report({
42
32
  messageId: 'missingFunction',
@@ -48,43 +38,19 @@ var _default = exports.default = (0, _utils.createRule)({
48
38
  // the only jest functions that are with "x" are "xdescribe", "xtest", and "xit"
49
39
  jestFnCall.name.startsWith('x') || jestFnCall.members.some(s => (0, _utils.getAccessorValue)(s) === 'skip')) {
50
40
  context.report({
51
- messageId: jestFnCall.type === 'describe' ? 'disabledSuite' : 'disabledTest',
41
+ messageId: 'skippedTest',
52
42
  node
53
43
  });
54
44
  }
55
45
  },
56
- 'CallExpression:exit'(node) {
57
- const jestFnCall = (0, _utils.parseJestFnCall)(node, context);
58
- if (!jestFnCall) {
59
- return;
60
- }
61
- if (jestFnCall.type === 'describe') {
62
- suiteDepth--;
63
- }
64
- if (jestFnCall.type === 'test') {
65
- testDepth--;
66
- }
67
- },
68
46
  'CallExpression[callee.name="pending"]'(node) {
69
47
  if ((0, _utils.resolveScope)((0, _utils.getScope)(context, node), 'pending')) {
70
48
  return;
71
49
  }
72
- if (testDepth > 0) {
73
- context.report({
74
- messageId: 'pendingTest',
75
- node
76
- });
77
- } else if (suiteDepth > 0) {
78
- context.report({
79
- messageId: 'pendingSuite',
80
- node
81
- });
82
- } else {
83
- context.report({
84
- messageId: 'pending',
85
- node
86
- });
87
- }
50
+ context.report({
51
+ messageId: 'skippedTest',
52
+ node
53
+ });
88
54
  }
89
55
  };
90
56
  }
@@ -28,7 +28,7 @@ var _default = exports.default = (0, _utils.createRule)({
28
28
  },
29
29
  fixable: 'code',
30
30
  messages: {
31
- unexpectedLowercase: '`{{ method }}`s should begin with lowercase'
31
+ unexpectedCase: '`{{ method }}`s should begin with lowercase'
32
32
  },
33
33
  schema: [{
34
34
  type: 'object',
@@ -94,7 +94,7 @@ var _default = exports.default = (0, _utils.createRule)({
94
94
  return;
95
95
  }
96
96
  context.report({
97
- messageId: 'unexpectedLowercase',
97
+ messageId: 'unexpectedCase',
98
98
  node: node.arguments[0],
99
99
  data: {
100
100
  method: jestFnCall.name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "28.11.1",
3
+ "version": "28.12.0",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",