const IS_EE = require('./config/helpers/is_ee_env'); const reporters = ['default']; // To have consistent date time parsing both in local and CI environments we set // the timezone of the Node process. https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27738 process.env.TZ = 'GMT'; if (process.env.CI) { reporters.push([ 'jest-junit', { output: './junit_jest.xml', }, ]); } // eslint-disable-next-line import/no-commonjs module.exports = { testMatch: ['/spec/frontend/**/*_spec.js', '/ee/spec/frontend/**/*_spec.js'], moduleFileExtensions: ['js', 'json', 'vue'], moduleNameMapper: { '^~(/.*)$': '/app/assets/javascripts$1', '^ee(/.*)$': '/ee/app/assets/javascripts$1', '^ee_else_ce(/.*)$': IS_EE ? '/ee/app/assets/javascripts$1' : '/app/assets/javascripts$1', '^helpers(/.*)$': '/spec/frontend/helpers$1', '^vendor(/.*)$': '/vendor/assets/javascripts$1', '\\.(jpg|jpeg|png|svg)$': '/spec/frontend/__mocks__/file_mock.js', 'emojis(/.*).json': '/fixtures/emojis$1.json', }, collectCoverageFrom: ['/app/assets/javascripts/**/*.{js,vue}'], coverageDirectory: '/coverage-frontend/', coverageReporters: ['json', 'lcov', 'text-summary', 'clover'], cacheDirectory: '/tmp/cache/jest', modulePathIgnorePatterns: ['/.yarn-cache/'], reporters, setupFilesAfterEnv: ['/spec/frontend/test_setup.js'], restoreMocks: true, transform: { '^.+\\.(gql|graphql)$': 'jest-transform-graphql', '^.+\\.js$': 'babel-jest', '^.+\\.vue$': 'vue-jest', }, transformIgnorePatterns: ['node_modules/(?!(@gitlab/ui)/)'], timers: 'fake', testEnvironment: '/spec/frontend/environment.js', testEnvironmentOptions: { IS_EE, }, };