diff --git a/jest.config.js b/jest.config.js index 84481642250f38897efb91f0c70af85d32229e8c..986b8465eefb56b27e7685193a7f4a8de4a8726c 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,9 +15,18 @@ if (process.env.CI) { ]); } +let testMatch = ['/spec/frontend/**/*_spec.js', '/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.path.includes('/eslint-import-resolver-jest/'); +if (isESLint) { + testMatch = testMatch.map(path => path.replace('_spec.js', '')); +} + // eslint-disable-next-line import/no-commonjs module.exports = { - testMatch: ['/spec/frontend/**/*_spec.js', '/ee/spec/frontend/**/*_spec.js'], + testMatch, moduleFileExtensions: ['js', 'json', 'vue'], moduleNameMapper: { '^~(/.*)$': '/app/assets/javascripts$1', diff --git a/spec/frontend/error_tracking_settings/mock.js b/spec/frontend/error_tracking_settings/mock.js index 42233f82d54d9f277e46147f279d415002dd4bdf..8c5bfd08beb00adc1588ce00fec0d16222c66166 100644 --- a/spec/frontend/error_tracking_settings/mock.js +++ b/spec/frontend/error_tracking_settings/mock.js @@ -1,5 +1,5 @@ import createStore from '~/error_tracking_settings/store'; -import { TEST_HOST } from '../helpers/test_constants'; +import { TEST_HOST } from 'helpers/test_constants'; const defaultStore = createStore();