2019-03-28 08:38:29 -04:00
|
|
|
const IS_EE = require('./config/helpers/is_ee_env');
|
2018-08-29 16:45:53 -04:00
|
|
|
|
|
|
|
const reporters = ['default'];
|
|
|
|
|
|
|
|
if (process.env.CI) {
|
|
|
|
reporters.push([
|
|
|
|
'jest-junit',
|
|
|
|
{
|
|
|
|
output: './junit_jest.xml',
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-commonjs
|
|
|
|
module.exports = {
|
2019-02-20 16:01:16 -05:00
|
|
|
testMatch: ['<rootDir>/spec/frontend/**/*_spec.js', '<rootDir>/ee/spec/frontend/**/*_spec.js'],
|
2018-12-10 06:08:55 -05:00
|
|
|
moduleFileExtensions: ['js', 'json', 'vue'],
|
2018-08-29 16:45:53 -04:00
|
|
|
moduleNameMapper: {
|
2019-04-03 13:58:42 -04:00
|
|
|
'^~(/.*)$': '<rootDir>/app/assets/javascripts$1',
|
|
|
|
'^ee(/.*)$': '<rootDir>/ee/app/assets/javascripts$1',
|
|
|
|
'^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',
|
2019-02-26 07:26:15 -05:00
|
|
|
'\\.(jpg|jpeg|png|svg)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js',
|
2019-05-01 06:04:07 -04:00
|
|
|
'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json',
|
2018-08-29 16:45:53 -04:00
|
|
|
},
|
|
|
|
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,
|
2019-02-28 06:34:47 -05:00
|
|
|
setupFilesAfterEnv: ['<rootDir>/spec/frontend/test_setup.js'],
|
2018-12-11 06:18:42 -05:00
|
|
|
restoreMocks: true,
|
2018-12-10 06:08:55 -05:00
|
|
|
transform: {
|
2019-02-26 07:26:15 -05:00
|
|
|
'^.+\\.(gql|graphql)$': 'jest-transform-graphql',
|
2018-12-10 06:08:55 -05:00
|
|
|
'^.+\\.js$': 'babel-jest',
|
|
|
|
'^.+\\.vue$': 'vue-jest',
|
|
|
|
},
|
2019-02-20 15:27:23 -05:00
|
|
|
transformIgnorePatterns: ['node_modules/(?!(@gitlab/ui)/)'],
|
2019-03-21 13:04:33 -04:00
|
|
|
timers: 'fake',
|
2019-03-26 15:49:05 -04:00
|
|
|
testEnvironment: '<rootDir>/spec/frontend/environment.js',
|
2019-03-28 08:38:29 -04:00
|
|
|
testEnvironmentOptions: {
|
|
|
|
IS_EE,
|
|
|
|
},
|
2018-08-29 16:45:53 -04:00
|
|
|
};
|