From 57d234ae02e5027b69891d637d5e892b670f96ca Mon Sep 17 00:00:00 2001 From: gianantoniopini <63844628+gianantoniopini@users.noreply.github.com> Date: Mon, 4 Jan 2021 12:09:04 +0100 Subject: [PATCH] Jest configuration: added settings for code coverage --- .gitignore | 3 +++ jest.config.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 4a5ee8d9..38cd07b9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ coverage # nyc test coverage .nyc_output +# Coverage directory used by Jest +test-coverage + # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) .grunt diff --git a/jest.config.js b/jest.config.js index 0447c14d..5bf33e08 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,22 @@ module.exports = { + testRegex: '/*.test.js$', + collectCoverage: true, + collectCoverageFrom: [ + '**/*.{js,jsx}', + '!\\.cache/**', + '!node_modules/**', + '!public/**', + ], + coverageReporters: ['lcov'], + coverageDirectory: 'test-coverage', + coverageThreshold: { + global: { + branches: 0, + functions: 0, + lines: 0, + statements: 0, + }, + }, transform: { '^.+\\.jsx?$': `/jest-preprocess.js`, },