Skip to content

Commit

Permalink
fix(jest): correctly test jest rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel committed Aug 27, 2021
1 parent dff61a8 commit 617d895
Show file tree
Hide file tree
Showing 5 changed files with 1,938 additions and 54 deletions.
13 changes: 1 addition & 12 deletions packages/eslint-config-algolia/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ module.exports = {
env: {
jest: true,
},
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
extends: ['plugin:jest/recommended', 'plugin:jest/style', './rules/jest.js'],
plugins: ['jest'],
rules: {
'consistent-test-it': ['error'],
'max-nested-describe': ['error', { max: 3 }],
'no-alias-methods': ['error'],
'no-duplicate-hooks': ['error'],
'no-test-return-statement': ['warn'],
'prefer-hooks-on-top': ['error'],
'prefer-spy-on': ['error'],
'require-to-throw-message': ['error'],
'require-top-level-describe': ['error'],
},
};
14 changes: 14 additions & 0 deletions packages/eslint-config-algolia/rules/jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
rules: {
'jest/consistent-test-it': ['error'],
'jest/max-nested-describe': ['error', { max: 3 }],
'jest/no-alias-methods': ['error'],
'jest/no-duplicate-hooks': ['error'],
'jest/no-test-return-statement': ['warn'],
'jest/prefer-hooks-on-top': ['error'],
'jest/prefer-spy-on': ['error'],
'jest/require-to-throw-message': ['error'],
'jest/require-top-level-describe': ['error'],
},
};
2 changes: 1 addition & 1 deletion packages/test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
extends: ['algolia', 'algolia/react', 'algolia/typescript'],
extends: ['algolia', 'algolia/react', 'algolia/typescript', 'algolia/jest'],
};
1 change: 1 addition & 0 deletions packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@typescript-eslint/eslint-plugin": "4.29.3",
"@typescript-eslint/parser": "4.29.3",
"eslint-config-algolia": "19.0.1",
"jest": "27.1.0",
"prop-types": "15.7.2",
"react": "17.0.2",
"react-addons-shallow-compare": "15.6.3",
Expand Down
Loading

0 comments on commit 617d895

Please sign in to comment.