From 2c79a4c122957e85c8ad7eb47c44084e0fdceee9 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Fri, 4 Dec 2020 20:00:20 -0500 Subject: [PATCH] Remove non application files from frontend code coverage (#11752) * Convert index.jsx to index.js as they are just barrel files. * Removed prop types and eslint configs from code coverage. * Using in test ignore patterns now. * Added app/javascript/storybook-static to eslint's ignore list. * Now .storybook is excluded from code coverage. * Bumped coverage thresholds * Fixed to --- .eslintignore | 1 + .../CommentSubscription/{index.jsx => index.js} | 0 .../components/{index.jsx => index.js} | 0 .../articles/components/{index.jsx => index.js} | 0 app/javascript/podcasts/{index.jsx => index.js} | 0 jest.config.js | 16 +++++++++++----- 6 files changed, 12 insertions(+), 5 deletions(-) rename app/javascript/CommentSubscription/{index.jsx => index.js} (100%) rename app/javascript/article-form/components/{index.jsx => index.js} (100%) rename app/javascript/articles/components/{index.jsx => index.js} (100%) rename app/javascript/podcasts/{index.jsx => index.js} (100%) diff --git a/.eslintignore b/.eslintignore index f5023e9e4..1e4c74d6e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ package.json app/assets/javascripts/lib/ +app/javascript/storybook-static/ \ No newline at end of file diff --git a/app/javascript/CommentSubscription/index.jsx b/app/javascript/CommentSubscription/index.js similarity index 100% rename from app/javascript/CommentSubscription/index.jsx rename to app/javascript/CommentSubscription/index.js diff --git a/app/javascript/article-form/components/index.jsx b/app/javascript/article-form/components/index.js similarity index 100% rename from app/javascript/article-form/components/index.jsx rename to app/javascript/article-form/components/index.js diff --git a/app/javascript/articles/components/index.jsx b/app/javascript/articles/components/index.js similarity index 100% rename from app/javascript/articles/components/index.jsx rename to app/javascript/articles/components/index.js diff --git a/app/javascript/podcasts/index.jsx b/app/javascript/podcasts/index.js similarity index 100% rename from app/javascript/podcasts/index.jsx rename to app/javascript/podcasts/index.js diff --git a/jest.config.js b/jest.config.js index 149954883..8b0230a73 100644 --- a/jest.config.js +++ b/jest.config.js @@ -16,13 +16,19 @@ module.exports = { '!**/__tests__/**', '!**/__stories__/**', '!app/javascript/storybook-static/**/*.js', + // We do not need code coverage on files that are prop types + // or eslint configuration files. + '!app/javascript/**/*PropTypes.js', + '!./**/.eslintrc.js', + // Ignore Storybook configuration files + '!app/javascript/.storybook/**/*.{js,jsx}', ], coverageThreshold: { global: { - statements: 42, - branches: 38, + statements: 43, + branches: 39, functions: 41, - lines: 42, + lines: 43, }, }, moduleNameMapper: { @@ -34,10 +40,10 @@ module.exports = { // picked up by jest if this folder is not excluded causing a false negative of a test suite failing. testPathIgnorePatterns: [ '/node_modules/', - './config/webpack', + '/config/webpack', // Allows developers to add utility modules that jest won't run as test suites. '/__tests__/utilities/', - './app/javascript/storybook-static', + '/app/javascript/storybook-static', ], watchPlugins: [ 'jest-watch-typeahead/filename',