From 234f5f3b7668de7215d16ceb148c034376dea44c Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sun, 1 Nov 2026 17:48:03 -0300 Subject: [PATCH] test(require): expect the file module on case-insensitive file systems With MyModule.js and a mymodule/ folder side by side, require('./mymodule') resolves mymodule.js first; on a case-insensitive file system (Mac Catalyst on a default macOS volume) that is MyModule.js, as Node does on macOS, so the folder module never loads. Derive the expectation from the same existence check the resolver makes instead of assuming a case-sensitive device. --- Require/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Require/index.js b/Require/index.js index dc45956..b858f03 100644 --- a/Require/index.js +++ b/Require/index.js @@ -293,8 +293,12 @@ describe("TNS require", function () { require("./CaseSensitive"); // WARNING: The following test is runtime specific - the V8-based runtimes // (android and v8-ios) load both the file and the folder module here, - // the legacy JSC iOS runtime only the file - var expected = global.TNSRuntime ? 'file' : 'filefolder'; + // the legacy JSC iOS runtime only the file. On a case-insensitive file + // system (Mac Catalyst on a default macOS volume) './mymodule' finds + // MyModule.js before the folder, as Node does on macOS. + var caseInsensitive = !!global.NSFileManager && + NSFileManager.defaultManager.fileExistsAtPath(__dirname + "/CaseSensitive/mymodule.js"); + var expected = global.TNSRuntime ? 'file' : (caseInsensitive ? 'filefile' : 'filefolder'); expect(TNSGetOutput()).toBe(expected); });