diff --git a/tests/src/core/resolve.js b/tests/src/core/resolve.js index bfff7935c..307befcde 100644 --- a/tests/src/core/resolve.js +++ b/tests/src/core/resolve.js @@ -3,6 +3,7 @@ import { expect } from 'chai' import resolve, { CASE_SENSITIVE_FS, fileExistsWithCaseSync } from 'eslint-module-utils/resolve' import ModuleCache from 'eslint-module-utils/ModuleCache' +import * as path from 'path' import * as fs from 'fs' import * as utils from '../utils' @@ -133,6 +134,11 @@ describe('resolve', function () { expect(fileExistsWithCaseSync(file, ModuleCache.getSettings(testContext))) .to.be.false }) + it('detecting case does not include parent folder path (issue #720)', function () { + const f = path.join(process.cwd().toUpperCase(), './tests/files/jsx/MyUnCoolComponent.jsx') + expect(fileExistsWithCaseSync(f, ModuleCache.getSettings(testContext), true)) + .to.be.true + }) }) describe('rename cache correctness', function () { diff --git a/utils/resolve.js b/utils/resolve.js index 1d6e164b1..8193e7731 100644 --- a/utils/resolve.js +++ b/utils/resolve.js @@ -21,6 +21,7 @@ exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cache // null means it resolved to a builtin if (filepath === null) return true + if (filepath.toLowerCase() === process.cwd().toLowerCase()) return true const parsedPath = path.parse(filepath) , dir = parsedPath.dir