diff --git a/.eslintrc.json b/.eslintrc.json index 13c0be6da..f753690d1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -73,10 +73,27 @@ "space-infix-ops": ["error"], "yoda": ["error"] }, + "ignorePatterns": [ "coverage" ], "overrides": [ { "files": [ "./**/*.js" ] }, + { + "files": [ "./**/*.test.js" ], + "plugins": [ "jest" ], + "env": { + "jest/globals": true + }, + "extends": [ + "plugin:jest/recommended", + "plugin:jest/style" + ], + "rules": { + "jest/consistent-test-it": ["error"], + "jest/lowercase-name": ["error", { "ignoreTopLevelDescribe": true }], + "jest/require-top-level-describe": ["error"] + } + }, { "files": [ "./assets/**/*.staticjs" ], "extends": [ diff --git a/.gitignore b/.gitignore index ee54022e5..f0c352351 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +coverage node_modules/**/* .expo/* .expo-shared/* diff --git a/__tests__/.eslintrc.json b/__tests__/.eslintrc.json deleted file mode 100644 index 8fe477c64..000000000 --- a/__tests__/.eslintrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "env": { - "jest": true - } -} \ No newline at end of file diff --git a/package.json b/package.json index 731e73c78..ce606ecbd 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,16 @@ "test": "node ./node_modules/jest/bin/jest.js --watchAll" }, "jest": { - "preset": "jest-expo" + "preset": "jest-expo", + "collectCoverage": true, + "collectCoverageFrom": [ + "**/*.{js,jsx}", + "!**/coverage/**", + "!**/node_modules/**", + "!**/babel.config.js", + "!**/metro.config.js", + "!**/jest.setup.js" + ] }, "browserslist": [ "iOS > 10", @@ -61,6 +70,7 @@ "eslint-plugin-compat": "^3.9.0", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^24.1.5", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-react": "^7.14.3", "eslint-plugin-react-native": "^3.10.0", diff --git a/yarn.lock b/yarn.lock index 3676dcf9d..a835c3031 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2803,6 +2803,11 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/json-schema@^7.0.3": + version "7.0.7" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad" + integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA== + "@types/json-schema@^7.0.4": version "7.0.5" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" @@ -2987,6 +2992,18 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/experimental-utils@^4.0.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz#d744d1ac40570a84b447f7aa1b526368afd17eec" + integrity sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/scope-manager" "4.15.1" + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/typescript-estree" "4.15.1" + eslint-scope "^5.0.0" + eslint-utils "^2.0.0" + "@typescript-eslint/parser@^4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.9.1.tgz#2d74c4db5dd5117379a9659081a4d1ec02629055" @@ -2997,6 +3014,14 @@ "@typescript-eslint/typescript-estree" "4.9.1" debug "^4.1.1" +"@typescript-eslint/scope-manager@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz#f6511eb38def2a8a6be600c530c243bbb56ac135" + integrity sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA== + dependencies: + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/visitor-keys" "4.15.1" + "@typescript-eslint/scope-manager@4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.9.1.tgz#cc2fde310b3f3deafe8436a924e784eaab265103" @@ -3005,11 +3030,29 @@ "@typescript-eslint/types" "4.9.1" "@typescript-eslint/visitor-keys" "4.9.1" +"@typescript-eslint/types@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.15.1.tgz#da702f544ef1afae4bc98da699eaecd49cf31c8c" + integrity sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw== + "@typescript-eslint/types@4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.9.1.tgz#a1a7dd80e4e5ac2c593bc458d75dd1edaf77faa2" integrity sha512-fjkT+tXR13ks6Le7JiEdagnwEFc49IkOyys7ueWQ4O8k4quKPwPJudrwlVOJCUQhXo45PrfIvIarcrEjFTNwUA== +"@typescript-eslint/typescript-estree@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz#fa9a9ff88b4a04d901ddbe5b248bc0a00cd610be" + integrity sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw== + dependencies: + "@typescript-eslint/types" "4.15.1" + "@typescript-eslint/visitor-keys" "4.15.1" + debug "^4.1.1" + globby "^11.0.1" + is-glob "^4.0.1" + semver "^7.3.2" + tsutils "^3.17.1" + "@typescript-eslint/typescript-estree@4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.9.1.tgz#6e5b86ff5a5f66809e1f347469fadeec69ac50bf" @@ -3024,6 +3067,14 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/visitor-keys@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz#c76abbf2a3be8a70ed760f0e5756bf62de5865dd" + integrity sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww== + dependencies: + "@typescript-eslint/types" "4.15.1" + eslint-visitor-keys "^2.0.0" + "@typescript-eslint/visitor-keys@4.9.1": version "4.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.9.1.tgz#d76374a58c4ead9e92b454d186fea63487b25ae1" @@ -6333,6 +6384,13 @@ eslint-plugin-import@^2.20.2: resolve "^1.17.0" tsconfig-paths "^3.9.0" +eslint-plugin-jest@^24.1.5: + version "24.1.5" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.5.tgz#1e866a9f0deac587d0a3d5d7cefe99815a580de2" + integrity sha512-FIP3lwC8EzEG+rOs1y96cOJmMVpdFNreoDJv29B5vIupVssRi8zrSY3QadogT0K3h1Y8TMxJ6ZSAzYUmFCp2hg== + dependencies: + "@typescript-eslint/experimental-utils" "^4.0.1" + eslint-plugin-promise@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz#845fd8b2260ad8f82564c1222fce44ad71d9418a" @@ -6384,7 +6442,7 @@ eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^5.1.1: +eslint-scope@^5.0.0, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -6392,7 +6450,7 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-utils@^2.1.0: +eslint-utils@^2.0.0, eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==