Commit a15c73be authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'dpisek-jest-config-move-integration-module-name-mappers' into 'master'

Move integration specs module name mappers from `jest.config.base` to `jest.config.integration` [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!56919
parents 45b6085d 1aecf748
const IS_EE = require('./config/helpers/is_ee_env'); const IS_EE = require('./config/helpers/is_ee_env');
const isESLint = require('./config/helpers/is_eslint'); const isESLint = require('./config/helpers/is_eslint');
module.exports = (path) => { module.exports = (path, options = {}) => {
const {
moduleNameMapper: extModuleNameMapper = {},
moduleNameMapperEE: extModuleNameMapperEE = {},
} = options;
const reporters = ['default']; const reporters = ['default'];
// To have consistent date time parsing both in local and CI environments we set // To have consistent date time parsing both in local and CI environments we set
...@@ -45,8 +50,7 @@ module.exports = (path) => { ...@@ -45,8 +50,7 @@ module.exports = (path) => {
'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json',
'^spec/test_constants$': '<rootDir>/spec/frontend/__helpers__/test_constants', '^spec/test_constants$': '<rootDir>/spec/frontend/__helpers__/test_constants',
'^jest/(.*)$': '<rootDir>/spec/frontend/$1', '^jest/(.*)$': '<rootDir>/spec/frontend/$1',
'^test_helpers(/.*)$': '<rootDir>/spec/frontend_integration/test_helpers$1', ...extModuleNameMapper,
'^ee_else_ce_test_helpers(/.*)$': '<rootDir>/spec/frontend_integration/test_helpers$1',
}; };
const collectCoverageFrom = ['<rootDir>/app/assets/javascripts/**/*.{js,vue}']; const collectCoverageFrom = ['<rootDir>/app/assets/javascripts/**/*.{js,vue}'];
...@@ -57,9 +61,9 @@ module.exports = (path) => { ...@@ -57,9 +61,9 @@ module.exports = (path) => {
'^ee(/.*)$': rootDirEE, '^ee(/.*)$': rootDirEE,
'^ee_component(/.*)$': rootDirEE, '^ee_component(/.*)$': rootDirEE,
'^ee_else_ce(/.*)$': rootDirEE, '^ee_else_ce(/.*)$': rootDirEE,
'^ee_else_ce_test_helpers(/.*)$': '<rootDir>/ee/spec/frontend_integration/test_helpers$1',
'^ee_jest/(.*)$': '<rootDir>/ee/spec/frontend/$1', '^ee_jest/(.*)$': '<rootDir>/ee/spec/frontend/$1',
[TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures-ee$1', [TEST_FIXTURES_PATTERN]: '<rootDir>/tmp/tests/frontend/fixtures-ee$1',
...extModuleNameMapperEE,
}); });
collectCoverageFrom.push(rootDirEE.replace('$1', '/**/*.{js,vue}')); collectCoverageFrom.push(rootDirEE.replace('$1', '/**/*.{js,vue}'));
......
const baseConfig = require('./jest.config.base'); const baseConfig = require('./jest.config.base');
module.exports = { module.exports = {
...baseConfig('spec/frontend_integration'), ...baseConfig('spec/frontend_integration', {
moduleNameMapper: {
'^test_helpers(/.*)$': '<rootDir>/spec/frontend_integration/test_helpers$1',
'^ee_else_ce_test_helpers(/.*)$': '<rootDir>/spec/frontend_integration/test_helpers$1',
},
moduleNameMapperEE: {
'^ee_else_ce_test_helpers(/.*)$': '<rootDir>/ee/spec/frontend_integration/test_helpers$1',
},
}),
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment