From 5a3b9914e02ff688bcff09d4a0f52031fe553dea Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 20 Nov 2020 22:30:13 +0100 Subject: [PATCH] [code coverage] Update jest config to collect more data (#83804) * collect code coverage for more files in src/ * update config * update config according review * move collectCoverageFrom to preset Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> # Conflicts: # src/dev/jest/config.js --- packages/kbn-test/jest-preset.js | 10 ++++++++++ src/dev/jest/config.js | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/kbn-test/jest-preset.js b/packages/kbn-test/jest-preset.js index 4a85eca206c96..f899a5b44ab6c 100644 --- a/packages/kbn-test/jest-preset.js +++ b/packages/kbn-test/jest-preset.js @@ -108,4 +108,14 @@ module.exports = { '[/\\\\]node_modules(?![\\/\\\\]monaco-editor)[/\\\\].+\\.js$', 'packages/kbn-pm/dist/index.js', ], + + // An array of regexp pattern strings that are matched against all source file paths, matched files to include/exclude for code coverage + collectCoverageFrom: [ + '**/*.{js,mjs,jsx,ts,tsx}', + '!**/{__test__,__snapshots__,__examples__,mocks,tests,test_helpers,integration_tests,types}/**/*', + '!**/*mock*.ts', + '!**/*.test.ts', + '!**/*.d.ts', + '!**/index.{js,ts}', + ], }; diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index d5a22bede00c0..050ef8b861e43 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -38,15 +38,5 @@ export default { '/src/test_utils', '/test/functional/services/remote', ], - collectCoverageFrom: [ - 'src/plugins/**/*.{ts,tsx}', - '!src/plugins/**/*.d.ts', - 'packages/kbn-ui-framework/src/components/**/*.js', - '!packages/kbn-ui-framework/src/components/index.js', - '!packages/kbn-ui-framework/src/components/**/*/index.js', - 'packages/kbn-ui-framework/src/services/**/*.js', - '!packages/kbn-ui-framework/src/services/index.js', - '!packages/kbn-ui-framework/src/services/**/*/index.js', - ], testRunner: 'jasmine2', };