Skip to content

Commit f9c5a59

Browse files
sergei-startsevljharb
authored andcommitted
debug: add logs
1 parent 42d5cf2 commit f9c5a59

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tests/src/core/resolve.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,10 @@ describe('resolve', function () {
340340
expect(fileExistsWithCaseSync(f, testSettings))
341341
.to.be.true;
342342
});
343-
it('detecting case should include parent folder path', function () {
343+
it.only('detecting case should include parent folder path', function () {
344344
const f = path.join(process.cwd().toUpperCase(), './tests/files/jsx/MyUnCoolComponent.jsx');
345+
console.log(process.cwd());
346+
console.log(f);
345347
expect(fileExistsWithCaseSync(f, testSettings, true))
346348
.to.be.false;
347349
});

utils/resolve.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,28 @@ function tryRequire(target, sourceFile) {
5555
exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings, strict) {
5656
// don't care if the FS is case-sensitive
5757
if (CASE_SENSITIVE_FS) return true;
58-
58+
console.log('case insensitive');
5959
// null means it resolved to a builtin
6060
if (filepath === null) return true;
6161
if (filepath.toLowerCase() === process.cwd().toLowerCase() && !strict) return true;
6262
const parsedPath = path.parse(filepath);
63+
console.log('parsedPath', parsedPath);
6364
const dir = parsedPath.dir;
6465

6566
let result = fileExistsCache.get(filepath, cacheSettings);
66-
if (result != null) return result;
67+
if (result != null) {
68+
console.log('result', result);
69+
return result;
70+
}
6771

6872
// base case
6973
if (dir === '' || parsedPath.root === filepath) {
74+
console.log('dir', dir);
75+
console.log('parsedPath.root', parsedPath.root);
7076
result = true;
7177
} else {
7278
const filenames = fs.readdirSync(dir);
79+
console.log('filenames:', filenames);
7380
if (filenames.indexOf(parsedPath.base) === -1) {
7481
result = false;
7582
} else {

0 commit comments

Comments
 (0)