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 <root_dir> 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 <rootDir>
This commit is contained in:
Nick Taylor 2020-12-04 20:00:20 -05:00 committed by GitHub
parent de119f59c1
commit 2c79a4c122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 5 deletions

View file

@ -1,2 +1,3 @@
package.json package.json
app/assets/javascripts/lib/ app/assets/javascripts/lib/
app/javascript/storybook-static/

View file

@ -16,13 +16,19 @@ module.exports = {
'!**/__tests__/**', '!**/__tests__/**',
'!**/__stories__/**', '!**/__stories__/**',
'!app/javascript/storybook-static/**/*.js', '!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: { coverageThreshold: {
global: { global: {
statements: 42, statements: 43,
branches: 38, branches: 39,
functions: 41, functions: 41,
lines: 42, lines: 43,
}, },
}, },
moduleNameMapper: { 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. // picked up by jest if this folder is not excluded causing a false negative of a test suite failing.
testPathIgnorePatterns: [ testPathIgnorePatterns: [
'/node_modules/', '/node_modules/',
'./config/webpack', '<rootDir>/config/webpack',
// Allows developers to add utility modules that jest won't run as test suites. // Allows developers to add utility modules that jest won't run as test suites.
'/__tests__/utilities/', '/__tests__/utilities/',
'./app/javascript/storybook-static', '<rootDir>/app/javascript/storybook-static',
], ],
watchPlugins: [ watchPlugins: [
'jest-watch-typeahead/filename', 'jest-watch-typeahead/filename',