eslint-plugin-jest
Advanced tools
Comparing version 24.3.6 to 24.3.7
@@ -0,1 +1,8 @@ | ||
## [24.3.7](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.6...v24.3.7) (2021-07-21) | ||
### Bug Fixes | ||
* **valid-describe:** report on concise-body arrow functions ([#863](https://github.com/jest-community/eslint-plugin-jest/issues/863)) ([71c5299](https://github.com/jest-community/eslint-plugin-jest/commit/71c5299b14cac6d85ba8f8bd939461503a60468f)) | ||
## [24.3.6](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.5...v24.3.6) (2021-04-26) | ||
@@ -2,0 +9,0 @@ |
@@ -30,3 +30,3 @@ # Enforces unbound methods are called with their expected scope (`unbound-method`) | ||
files: ['test/**'], | ||
extends: ['jest'], | ||
plugins: ['jest'], | ||
rules: { | ||
@@ -33,0 +33,0 @@ // you should turn the original rule off *only* for test files |
@@ -46,2 +46,8 @@ # Enforce valid `describe()` callback (`valid-describe`) | ||
}); | ||
// Returning a value from a describe block is not allowed | ||
describe('myFunction', () => | ||
it('returns a truthy value', () => { | ||
expect(myFunction()).toBeTruthy(); | ||
})); | ||
``` | ||
@@ -48,0 +54,0 @@ |
@@ -11,5 +11,5 @@ "use strict"; | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
@@ -16,0 +16,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -27,7 +27,7 @@ "use strict"; | ||
paths: [process.cwd()] | ||
}); // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
}); | ||
const jestPackageJson = // eslint-disable-next-line @typescript-eslint/no-require-imports | ||
require(jestPath); | ||
const jestPackageJson = require(jestPath); | ||
if (jestPackageJson.version) { | ||
@@ -34,0 +34,0 @@ const [majorVersion] = jestPackageJson.version.split('.'); |
@@ -87,2 +87,9 @@ "use strict"; | ||
if (callback.body.type === _experimentalUtils.AST_NODE_TYPES.CallExpression) { | ||
context.report({ | ||
messageId: 'unexpectedReturnInDescribe', | ||
node: callback | ||
}); | ||
} | ||
if (callback.body.type === _experimentalUtils.AST_NODE_TYPES.BlockStatement) { | ||
@@ -89,0 +96,0 @@ callback.body.body.forEach(node => { |
@@ -126,4 +126,3 @@ "use strict"; | ||
const testFunctionBody = body.body; | ||
const [fulfillmentCallback, rejectionCallback] = node.arguments; // then block can have two args, fulfillment & rejection | ||
const testFunctionBody = body.body; // then block can have two args, fulfillment & rejection | ||
// then block can have one args, fulfillment | ||
@@ -133,3 +132,3 @@ // catch block can have one args, rejection | ||
verifyExpectWithReturn([fulfillmentCallback, rejectionCallback], node.callee, context, testFunctionBody); | ||
verifyExpectWithReturn(node.arguments.slice(0, 2), node.callee, context, testFunctionBody); | ||
} | ||
@@ -136,0 +135,0 @@ } |
{ | ||
"name": "eslint-plugin-jest", | ||
"version": "24.3.6", | ||
"version": "24.3.7", | ||
"description": "Eslint rules for Jest", | ||
@@ -100,3 +100,3 @@ "keywords": [ | ||
"@typescript-eslint/parser": "^4.0.1", | ||
"babel-jest": "^26.0.1", | ||
"babel-jest": "^27.0.0", | ||
"babel-plugin-replace-ts-export-assignment": "^0.0.2", | ||
@@ -114,3 +114,3 @@ "dedent": "^0.7.0", | ||
"is-ci": "^3.0.0", | ||
"jest": "^26.0.1", | ||
"jest": "^27.0.0", | ||
"jest-runner-eslint": "^0.10.0", | ||
@@ -117,0 +117,0 @@ "lint-staged": "^10.2.2", |
@@ -16,5 +16,5 @@ <div align="center"> | ||
```bash | ||
yarn add --dev eslint eslint-plugin-jest | ||
``` | ||
$ yarn add --dev eslint eslint-plugin-jest | ||
``` | ||
@@ -21,0 +21,0 @@ **Note:** If you installed ESLint globally then you must also install |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254661
4103