summaryrefslogtreecommitdiff
path: root/jest.config.base.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /jest.config.base.js
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'jest.config.base.js')
-rw-r--r--jest.config.base.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jest.config.base.js b/jest.config.base.js
index 997f3c254b4..3ace87c49bc 100644
--- a/jest.config.base.js
+++ b/jest.config.base.js
@@ -1,10 +1,12 @@
const IS_EE = require('./config/helpers/is_ee_env');
const isESLint = require('./config/helpers/is_eslint');
+const IS_JH = require('./config/helpers/is_jh_env');
module.exports = (path, options = {}) => {
const {
moduleNameMapper: extModuleNameMapper = {},
moduleNameMapperEE: extModuleNameMapperEE = {},
+ moduleNameMapperJH: extModuleNameMapperJH = {},
} = options;
const reporters = ['default'];
@@ -29,6 +31,9 @@ module.exports = (path, options = {}) => {
testMatch.push(`<rootDir>/ee/${glob}`);
}
+ if (IS_JH) {
+ testMatch.push(`<rootDir>/jh/${glob}`);
+ }
// workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
if (isESLint(module)) {
@@ -41,8 +46,11 @@ module.exports = (path, options = {}) => {
'^~(/.*)$': '<rootDir>/app/assets/javascripts$1',
'^ee_component(/.*)$':
'<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js',
+ '^jh_component(/.*)$':
+ '<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js',
'^shared_queries(/.*)$': '<rootDir>/app/graphql/queries$1',
'^ee_else_ce(/.*)$': '<rootDir>/app/assets/javascripts$1',
+ '^jh_else_ce(/.*)$': '<rootDir>/app/assets/javascripts$1',
'^helpers(/.*)$': '<rootDir>/spec/frontend/__helpers__$1',
'^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1',
[TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures$1',
@@ -70,6 +78,19 @@ module.exports = (path, options = {}) => {
collectCoverageFrom.push(rootDirEE.replace('$1', '/**/*.{js,vue}'));
}
+ if (IS_JH) {
+ const rootDirJH = '<rootDir>/jh/app/assets/javascripts$1';
+ Object.assign(moduleNameMapper, {
+ '^jh(/.*)$': rootDirJH,
+ '^jh_component(/.*)$': rootDirJH,
+ '^jh_else_ce(/.*)$': rootDirJH,
+ '^jh_jest/(.*)$': '<rootDir>/jh/spec/frontend/$1',
+ ...extModuleNameMapperJH,
+ });
+
+ collectCoverageFrom.push(rootDirJH.replace('$1', '/**/*.{js,vue}'));
+ }
+
const coverageDirectory = () => {
if (process.env.CI_NODE_INDEX && process.env.CI_NODE_TOTAL) {
return `<rootDir>/coverage-frontend/jest-${process.env.CI_NODE_INDEX}-${process.env.CI_NODE_TOTAL}`;
@@ -107,6 +128,7 @@ module.exports = (path, options = {}) => {
testEnvironment: '<rootDir>/spec/frontend/environment.js',
testEnvironmentOptions: {
IS_EE,
+ IS_JH,
},
};
};