From 4ac9f1b8eaef29daa484b27a3113505cfa6a6dcb Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 30 Aug 2021 09:09:12 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- jest.config.base.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'jest.config.base.js') 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(`/ee/${glob}`); } + if (IS_JH) { + testMatch.push(`/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 = {}) => { '^~(/.*)$': '/app/assets/javascripts$1', '^ee_component(/.*)$': '/app/assets/javascripts/vue_shared/components/empty_component.js', + '^jh_component(/.*)$': + '/app/assets/javascripts/vue_shared/components/empty_component.js', '^shared_queries(/.*)$': '/app/graphql/queries$1', '^ee_else_ce(/.*)$': '/app/assets/javascripts$1', + '^jh_else_ce(/.*)$': '/app/assets/javascripts$1', '^helpers(/.*)$': '/spec/frontend/__helpers__$1', '^vendor(/.*)$': '/vendor/assets/javascripts$1', [TEST_FIXTURES_PATTERN]: '/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 = '/jh/app/assets/javascripts$1'; + Object.assign(moduleNameMapper, { + '^jh(/.*)$': rootDirJH, + '^jh_component(/.*)$': rootDirJH, + '^jh_else_ce(/.*)$': rootDirJH, + '^jh_jest/(.*)$': '/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 `/coverage-frontend/jest-${process.env.CI_NODE_INDEX}-${process.env.CI_NODE_TOTAL}`; @@ -107,6 +128,7 @@ module.exports = (path, options = {}) => { testEnvironment: '/spec/frontend/environment.js', testEnvironmentOptions: { IS_EE, + IS_JH, }, }; }; -- cgit v1.2.1