summaryrefslogtreecommitdiff
path: root/jest.config.js
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-07-10 13:27:39 +0000
committerClement Ho <clemmakesapps@gmail.com>2019-07-10 13:27:39 +0000
commita5d4c5879f67fdada8ed52b6e1476ea9b706c9d1 (patch)
tree765c7b06c610c86f5b23038616983eb0f23035cd /jest.config.js
parent863930cdfcca9051f0a5902ce3fa0594f3aeac52 (diff)
downloadgitlab-ce-a5d4c5879f67fdada8ed52b6e1476ea9b706c9d1.tar.gz
Workaround ESLint only resolving paths in test files
Diffstat (limited to 'jest.config.js')
-rw-r--r--jest.config.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/jest.config.js b/jest.config.js
index 84481642250..986b8465eef 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -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
module.exports = {
- testMatch: ['<rootDir>/spec/frontend/**/*_spec.js', '<rootDir>/ee/spec/frontend/**/*_spec.js'],
+ testMatch,
moduleFileExtensions: ['js', 'json', 'vue'],
moduleNameMapper: {
'^~(/.*)$': '<rootDir>/app/assets/javascripts$1',