Skip to content
代码片段 群组 项目
未验证 提交 aa9ac23e 编辑于 作者: Paul Slaughter's avatar Paul Slaughter
浏览文件

Fix eslint broken for Jest

**What happened?**
Previously we just checked the immediate parent
to see if the module was being included from eslint.
Now we recursively check all the parents.

Also moves this eslint check to it's own config/helper
上级 0b8ad496
无相关合并请求
/**
* Returns true if the given module is required from eslint
*/
const isESLint = mod => {
let parent = mod.parent;
while (parent) {
if (parent.filename.includes('/eslint')) {
return true;
}
parent = parent.parent;
}
return false;
};
module.exports = isESLint;
const IS_EE = require('./config/helpers/is_ee_env');
const isESLint = require('./config/helpers/is_eslint');
module.exports = path => {
const reporters = ['default'];
......@@ -24,9 +25,7 @@ module.exports = path => {
// workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
const { filename: parentModuleName } = module.parent;
const isESLint = parentModuleName && parentModuleName.includes('/eslint-import-resolver-jest/');
if (isESLint) {
if (isESLint(module)) {
testMatch = testMatch.map(path => path.replace('_spec.js', ''));
}
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册