Skip to content

Commit

Permalink
Revert "debug: add logs"
Browse files Browse the repository at this point in the history
This reverts commit f9c5a59.
  • Loading branch information
sergei-startsev committed Sep 3, 2021
1 parent f9c5a59 commit 7aaba21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 1 addition & 3 deletions tests/src/core/resolve.js
Expand Up @@ -340,10 +340,8 @@ describe('resolve', function () {
expect(fileExistsWithCaseSync(f, testSettings))
.to.be.true;
});
it.only('detecting case should include parent folder path', function () {
it('detecting case should include parent folder path', function () {
const f = path.join(process.cwd().toUpperCase(), './tests/files/jsx/MyUnCoolComponent.jsx');
console.log(process.cwd());
console.log(f);
expect(fileExistsWithCaseSync(f, testSettings, true))
.to.be.false;
});
Expand Down
11 changes: 2 additions & 9 deletions utils/resolve.js
Expand Up @@ -55,28 +55,21 @@ function tryRequire(target, sourceFile) {
exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings, strict) {
// don't care if the FS is case-sensitive
if (CASE_SENSITIVE_FS) return true;
console.log('case insensitive');

// null means it resolved to a builtin
if (filepath === null) return true;
if (filepath.toLowerCase() === process.cwd().toLowerCase() && !strict) return true;
const parsedPath = path.parse(filepath);
console.log('parsedPath', parsedPath);
const dir = parsedPath.dir;

let result = fileExistsCache.get(filepath, cacheSettings);
if (result != null) {
console.log('result', result);
return result;
}
if (result != null) return result;

// base case
if (dir === '' || parsedPath.root === filepath) {
console.log('dir', dir);
console.log('parsedPath.root', parsedPath.root);
result = true;
} else {
const filenames = fs.readdirSync(dir);
console.log('filenames:', filenames);
if (filenames.indexOf(parsedPath.base) === -1) {
result = false;
} else {
Expand Down

0 comments on commit 7aaba21

Please sign in to comment.