Skip to content

Commit

Permalink
feat: create jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jan 24, 2020
1 parent 6f8a7ae commit 1f039f4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
35 changes: 35 additions & 0 deletions jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
plugins: ['eslint-plugin-jest'],
extends: [
'plugin:eslint-plugin-jest/recommended',
'plugin:eslint-plugin-jest/style'
],
rules: {
'jest/consistent-test-it': 'error',
'jest/expect-expect': [
'error',
// todo: TBD - this will need adjusting for react-testing-library
{ assertFunctionNames: ['expect'] }
],
'jest/lowercase-name': [
'error', // todo switch to top flag once merged
{ ignore: ['describe'] }
],
'jest/no-expect-resolves': 'warn',
'jest/no-if': 'error', // todo: rename to no-conditional-expect
'jest/no-large-snapshots': 'warn',
'jest/no-test-return-statement': 'error',
'jest/no-truthy-falsy': 'error',
'jest/prefer-called-with': 'error',
// you can disable this if you use a `beforeEach` setup script,
'jest/prefer-expect-assertions': 'warn',
'jest/prefer-hooks-on-top': 'error',
'jest/prefer-inline-snapshots': 'warn',
'jest/prefer-spy-on': 'error',
'jest/prefer-strict-equal': 'error',
'jest/prefer-todo': 'error',
'jest/require-to-throw-message': 'error',
'jest/require-top-level-describe': 'error',
'jest/valid-title': 'error'
}
};
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"license": "ISC",
"author": "Gareth Jones",
"files": [
"index.js"
"index.js",
"jest.js"
],
"scripts": {
"lint": "eslint . --ignore-pattern '!.eslintrc.js' --ext js,ts",
Expand Down Expand Up @@ -56,6 +57,7 @@
"@typescript-eslint/parser": "^2.16.0",
"eslint": "^6.8.0",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-jest": "^23.4.0",
"eslint-plugin-local": "^1.0.0",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^3.1.0",
Expand Down

0 comments on commit 1f039f4

Please sign in to comment.