-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Labels
bugeach supportRelates to supporting the `each` methodRelates to supporting the `each` methodreleasedrule: consistent-test-it
Description
Description
When configuring the rule jest/consistent-test-it
, it doesn't work for describe.each
calls.
To Reproduce
$ cat .eslintrc.js
module.exports = {
plugins: ["jest"],
rules: {
"jest/consistent-test-it": ["error", { fn: "test", withinDescribe: "it" }],
},
};
$ cat package.json
{
"name": "jest-consistent-test-it-bug",
"scripts": {
"test": "eslint test.js"
},
"devDependencies": {
"eslint": "^7.22.0",
"eslint-plugin-jest": "^24.3.1"
}
}
$ cat test.js
var tests = [["jest/consistent-test-it", false]];
test("is valid", function () {});
describe("is valid", function () {
it("is valid", function () {});
})
describe.each(tests)("%s", function (name, bool) {
test("is valid, but should not be", function () {});
it("is not valid, but should be", function () {
expect(bool).toBe(true);
});
});
$ npm run test
> test
> eslint test.js
/home/kelly/wsp/jest-bug/test.js
12:3 error Prefer using 'test' instead of 'it' jest/consistent-test-it
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
npm ERR! code 1
npm ERR! path /home/kelly/wsp/jest-bug
npm ERR! command failed
npm ERR! command sh -c eslint test.js
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kelly/.npm/_logs/2021-03-16T19_23_17_839Z-debug.log
Metadata
Metadata
Assignees
Labels
bugeach supportRelates to supporting the `each` methodRelates to supporting the `each` methodreleasedrule: consistent-test-it