diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 14:31:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 14:31:16 +0300 |
commit | 905c1110b08f93a19661cf42a276c7ea90d0a0ff (patch) | |
tree | 756d138db422392c00471ab06acdff92c5a9b69c /jest.config.js | |
parent | 50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff) |
Add latest changes from gitlab-org/gitlab@12-4-stable-ee
Diffstat (limited to 'jest.config.js')
-rw-r--r-- | jest.config.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/jest.config.js b/jest.config.js index 646648c6928..c2a512e8afa 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,7 @@ 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 +// the timezone of the Node process. https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/27738 process.env.TZ = 'GMT'; if (process.env.CI) { @@ -15,11 +15,15 @@ if (process.env.CI) { ]); } -let testMatch = ['<rootDir>/spec/frontend/**/*_spec.js', '<rootDir>/ee/spec/frontend/**/*_spec.js']; +let testMatch = ['<rootDir>/spec/frontend/**/*_spec.js']; +if (IS_EE) { + testMatch.push('<rootDir>/ee/spec/frontend/**/*_spec.js'); +} // workaround for eslint-import-resolver-jest only resolving in test files // see https://github.com/JoinColony/eslint-import-resolver-jest#note -const isESLint = module.parent.filename.includes('/eslint-import-resolver-jest/'); +const { filename: parentModuleName } = module.parent; +const isESLint = parentModuleName && parentModuleName.includes('/eslint-import-resolver-jest/'); if (isESLint) { testMatch = testMatch.map(path => path.replace('_spec.js', '')); } @@ -41,6 +45,7 @@ module.exports = { '^vendor(/.*)$': '<rootDir>/vendor/assets/javascripts$1', '\\.(jpg|jpeg|png|svg)$': '<rootDir>/spec/frontend/__mocks__/file_mock.js', 'emojis(/.*).json': '<rootDir>/fixtures/emojis$1.json', + '^spec/test_constants$': '<rootDir>/spec/frontend/helpers/test_constants', }, collectCoverageFrom: ['<rootDir>/app/assets/javascripts/**/*.{js,vue}'], coverageDirectory: '<rootDir>/coverage-frontend/', @@ -62,3 +67,15 @@ module.exports = { IS_EE, }, }; + +const karmaTestFile = process.argv.find(arg => arg.includes('spec/javascripts/')); +if (karmaTestFile) { + console.error(` +Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma. +Please use the following command instead: + +yarn karma -f ${karmaTestFile} + +`); + process.exit(1); +} |