summaryrefslogtreecommitdiff
path: root/jest.config.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-30 21:07:58 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-30 21:07:58 +0000
commit0f0a8be306e7e0cd5693f57414de351808c41db9 (patch)
treed392e35e7b45c88de68cc5d433fac5ff98bb8504 /jest.config.js
parent3fe9588b1c1c4fb58f8ba8e9c27244fc2fc1c103 (diff)
downloadgitlab-ce-0f0a8be306e7e0cd5693f57414de351808c41db9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'jest.config.js')
-rw-r--r--jest.config.js37
1 files changed, 22 insertions, 15 deletions
diff --git a/jest.config.js b/jest.config.js
index c2a512e8afa..f5e589934e6 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -28,25 +28,32 @@ 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'],