diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 22:11:55 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-19 22:11:55 +0000 |
commit | 5a8431feceba47fd8e1804d9aa1b1730606b71d5 (patch) | |
tree | e5df8e0ceee60f4af8093f5c4c2f934b8abced05 /jest.config.js | |
parent | 4d477238500c347c6553d335d920bedfc5a46869 (diff) | |
download | gitlab-ce-5a8431feceba47fd8e1804d9aa1b1730606b71d5.tar.gz |
Add latest changes from gitlab-org/gitlab@12-5-stable-ee
Diffstat (limited to 'jest.config.js')
-rw-r--r-- | jest.config.js | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/jest.config.js b/jest.config.js index c2a512e8afa..3f9dc3fe213 100644 --- a/jest.config.js +++ b/jest.config.js @@ -28,32 +28,39 @@ if (isESLint) { testMatch = testMatch.map(path => path.replace('_spec.js', '')); } +const moduleNameMapper = { + '^~(/.*)$': '<rootDir>/app/assets/javascripts$1', + '^ee_component(/.*)$': + '<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js', + '^ee_else_ce(/.*)$': '<rootDir>/app/assets/javascripts$1', + '^helpers(/.*)$': '<rootDir>/spec/frontend/helpers$1', + '^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1', + '\\.(jpg|jpeg|png|svg)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', + 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', + '^spec/test_constants$': '<rootDir>/spec/frontend/helpers/test_constants', +}; + +if (IS_EE) { + const rootDirEE = '<rootDir>/ee/app/assets/javascripts$1'; + Object.assign(moduleNameMapper, { + '^ee(/.*)$': rootDirEE, + '^ee_component(/.*)$': rootDirEE, + '^ee_else_ce(/.*)$': rootDirEE, + }); +} + // eslint-disable-next-line import/no-commonjs module.exports = { testMatch, moduleFileExtensions: ['js', 'json', 'vue'], - moduleNameMapper: { - '^~(/.*)$': '<rootDir>/app/assets/javascripts$1', - '^ee(/.*)$': '<rootDir>/ee/app/assets/javascripts$1', - '^ee_component(/.*)$': IS_EE - ? '<rootDir>/ee/app/assets/javascripts$1' - : '<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js', - '^ee_else_ce(/.*)$': IS_EE - ? '<rootDir>/ee/app/assets/javascripts$1' - : '<rootDir>/app/assets/javascripts$1', - '^helpers(/.*)$': '<rootDir>/spec/frontend/helpers$1', - '^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1', - '\\.(jpg|jpeg|png|svg)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', - 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', - '^spec/test_constants$': '<rootDir>/spec/frontend/helpers/test_constants', - }, + moduleNameMapper, collectCoverageFrom: ['<rootDir>/app/assets/javascripts/**/*.{js,vue}'], coverageDirectory: '<rootDir>/coverage-frontend/', coverageReporters: ['json', 'lcov', 'text-summary', 'clover'], cacheDirectory: '<rootDir>/tmp/cache/jest', modulePathIgnorePatterns: ['<rootDir>/.yarn-cache/'], reporters, - setupFilesAfterEnv: ['<rootDir>/spec/frontend/test_setup.js'], + setupFilesAfterEnv: ['<rootDir>/spec/frontend/test_setup.js', 'jest-canvas-mock'], restoreMocks: true, transform: { '^.+\\.(gql|graphql)$': 'jest-transform-graphql', |