Skip to content

Commit

Permalink
Workaround for Jest duplicate manual mock warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Sep 29, 2020
1 parent da134f3 commit 1ee1146
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ export default {
coverageDirectory: '<rootDir>/target/kibana-coverage/jest',
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
moduleFileExtensions: ['js', 'mjs', 'json', 'ts', 'tsx', 'node'],
modulePathIgnorePatterns: ['__fixtures__/', 'target/'],
modulePathIgnorePatterns: [
'/__fixtures__/',
'/target/',

// duplicate manual mock work-around https://github.com/facebook/jest/issues/2070
'/__mocks__/',
],
testEnvironment: 'jest-environment-jsdom-thirteen',
testMatch: ['**/*.test.{js,mjs,ts,tsx}'],
testPathIgnorePatterns: [
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions x-pack/dev-tools/jest/create_jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ export function createJestConfig({ kibanaDirectory, rootDir, xPackKibanaDirector
'^test_utils/stub_web_worker': `${xPackKibanaDirectory}/test_utils/stub_web_worker.ts`,
'^(!!)?file-loader!': fileMockPath,
},
modulePathIgnorePatterns: [
'/__fixtures__/',
'/target/',

// duplicate manual mock work-around https://github.com/facebook/jest/issues/2070
'/__mocks__/',
],
collectCoverageFrom: [
'plugins/**/*.{js,mjs,jsx,ts,tsx}',
'!**/{__test__,__snapshots__,__examples__,integration_tests,tests}/**',
Expand Down

0 comments on commit 1ee1146

Please sign in to comment.