Merge branch 'winh-eslint-import-resolver-jest-workaround' into 'master'
Workaround ESLint only resolving paths in test files Closes #64061 See merge request gitlab-org/gitlab-ce!30296
This commit is contained in:
commit
e787676b37
|
@ -15,9 +15,18 @@ if (process.env.CI) {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let testMatch = ['<rootDir>/spec/frontend/**/*_spec.js', '<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.path.includes('/eslint-import-resolver-jest/');
|
||||||
|
if (isESLint) {
|
||||||
|
testMatch = testMatch.map(path => path.replace('_spec.js', ''));
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
// eslint-disable-next-line import/no-commonjs
|
||||||
module.exports = {
|
module.exports = {
|
||||||
testMatch: ['<rootDir>/spec/frontend/**/*_spec.js', '<rootDir>/ee/spec/frontend/**/*_spec.js'],
|
testMatch,
|
||||||
moduleFileExtensions: ['js', 'json', 'vue'],
|
moduleFileExtensions: ['js', 'json', 'vue'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^~(/.*)$': '<rootDir>/app/assets/javascripts$1',
|
'^~(/.*)$': '<rootDir>/app/assets/javascripts$1',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import createStore from '~/error_tracking_settings/store';
|
import createStore from '~/error_tracking_settings/store';
|
||||||
import { TEST_HOST } from '../helpers/test_constants';
|
import { TEST_HOST } from 'helpers/test_constants';
|
||||||
|
|
||||||
const defaultStore = createStore();
|
const defaultStore = createStore();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue