Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jest-community/eslint-plugin-jest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v24.3.1
Choose a base ref
...
head repository: jest-community/eslint-plugin-jest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v24.3.2
Choose a head ref
  • 4 commits
  • 6 files changed
  • 3 contributors

Commits on Mar 15, 2021

  1. Copy the full SHA
    7f6f54a View commit details

Commits on Mar 16, 2021

  1. Copy the full SHA
    a431d07 View commit details
  2. Copy the full SHA
    035bd30 View commit details
  3. chore(release): 24.3.2 [skip ci]

    ## [24.3.2](v24.3.1...v24.3.2) (2021-03-16)
    
    ### Bug Fixes
    
    * **consistent-test-it:** properly handle `describe.each` ([#796](#796)) ([035bd30](035bd30)), closes [#795](#795)
    semantic-release-bot committed Mar 16, 2021
    Copy the full SHA
    e6b8c77 View commit details
Showing with 244 additions and 178 deletions.
  1. +1 −1 .github/workflows/nodejs.yml
  2. +7 −0 CHANGELOG.md
  3. +1 −1 package.json
  4. +41 −0 src/rules/__tests__/consistent-test-it.test.ts
  5. +2 −1 src/rules/consistent-test-it.ts
  6. +192 −175 yarn.lock
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ jobs:
run: yarn test --coverage ${{ matrix.eslint-version >= 6 }}
env:
CI: true
- uses: codecov/codecov-action@v1.2.2
- uses: codecov/codecov-action@v1.3.1
if: ${{ matrix.eslint-version >= 6 }}
test-os:
name: Test on ${{ matrix.os }} using Node.js LTS
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [24.3.2](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.1...v24.3.2) (2021-03-16)


### Bug Fixes

* **consistent-test-it:** properly handle `describe.each` ([#796](https://github.com/jest-community/eslint-plugin-jest/issues/796)) ([035bd30](https://github.com/jest-community/eslint-plugin-jest/commit/035bd30af43f1215e65bf1b26c2ef2e6d174d3c8)), closes [#795](https://github.com/jest-community/eslint-plugin-jest/issues/795)

## [24.3.1](https://github.com/jest-community/eslint-plugin-jest/compare/v24.3.0...v24.3.1) (2021-03-13)


2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-jest",
"version": "24.3.1",
"version": "24.3.2",
"description": "Eslint rules for Jest",
"keywords": [
"eslint",
41 changes: 41 additions & 0 deletions src/rules/__tests__/consistent-test-it.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import dedent from 'dedent';
import resolveFrom from 'resolve-from';
import rule from '../consistent-test-it';
import { TestCaseName } from '../utils';
@@ -172,6 +173,46 @@ ruleTester.run('consistent-test-it with fn=test', rule, {
},
],
},
{
code: 'describe.each``("foo", () => { test.each``("bar") })',
output: 'describe.each``("foo", () => { it.each``("bar") })',
options: [{ fn: TestCaseName.it }],
errors: [
{
messageId: 'consistentMethodWithinDescribe',
data: {
testKeywordWithinDescribe: TestCaseName.it,
oppositeTestKeyword: TestCaseName.test,
},
},
],
},
{
code: dedent`
describe.each()("%s", () => {
test("is valid, but should not be", () => {});
it("is not valid, but should be", () => {});
});
`,
output: dedent`
describe.each()("%s", () => {
it("is valid, but should not be", () => {});
it("is not valid, but should be", () => {});
});
`,
options: [{ fn: TestCaseName.test, withinDescribe: TestCaseName.it }],
errors: [
{
messageId: 'consistentMethodWithinDescribe',
data: {
testKeywordWithinDescribe: TestCaseName.it,
oppositeTestKeyword: TestCaseName.test,
},
},
],
},
{
code: 'describe("suite", () => { it("foo") })',
output: 'describe("suite", () => { test("foo") })',
3 changes: 2 additions & 1 deletion src/rules/consistent-test-it.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ import {
createRule,
getNodeName,
isDescribe,
isEachCall,
isTestCase,
} from './utils';

@@ -120,7 +121,7 @@ export default createRule<
}
},
'CallExpression:exit'(node) {
if (isDescribe(node)) {
if (isDescribe(node) && !isEachCall(node)) {
describeNestingLevel--;
}
},
Loading