Skip to content

The agent that grows with you

test(desktop-plugins): a Desktop/ folder publishes on a real case-insensitive volume

kshitijk4poor4674c0c1f51f
diff --git a/apps/desktop/electron/desktop-plugins-root.test.ts b/apps/desktop/electron/desktop-plugins-root.test.ts
index db4a1a6d2b8..a576730a7a3 100644
--- a/apps/desktop/electron/desktop-plugins-root.test.ts
+++ b/apps/desktop/electron/desktop-plugins-root.test.ts
@@ -26,6 +26,19 @@ function write(file: string, text: string) {
fs.writeFileSync(file, text)
}
+/** Whether this host's temporary folder ignores case: create `X`, look for `x`. */
+function caseInsensitiveTmp(): boolean {
+ const probe = fs.mkdtempSync(path.join(os.tmpdir(), 'hermes-dp-case-'))
+
+ try {
+ fs.mkdirSync(path.join(probe, 'Desktop'))
+
+ return fs.existsSync(path.join(probe, 'desktop'))
+ } finally {
+ fs.rmSync(probe, { force: true, recursive: true })
+ }
+}
+
afterEach(() => {
for (const home of homes.splice(0)) {
fs.rmSync(home, { force: true, recursive: true })
@@ -495,6 +508,24 @@ describe('desktop tree publication', () => {
}
)
+ // The stand-in above runs everywhere; this one runs where the temporary folder really ignores case
+ // (macOS APFS and Windows NTFS by default), with `Desktop/` the only spelling on disk.
+ it.runIf(caseInsensitiveTmp())(
+ 'publishes a Desktop/ folder that a case-insensitive volume finds as desktop/',
+ async () => {
+ const home = makeHome()
+ const appRoot = path.join(home, 'desktop-plugins')
+ const pkg = path.join(home, 'plugins', 'media')
+ write(path.join(pkg, 'Desktop', 'plugin.js'), 'export default {}')
+
+ await expect(reconcileDesktopHalvesReport(home, appRoot)).resolves.toEqual({
+ published: [path.join(appRoot, 'media')],
+ refused: []
+ })
+ expect(fs.readFileSync(path.join(appRoot, 'media', 'plugin.js'), 'utf8')).toBe('export default {}')
+ }
+ )
+
it.skipIf(process.platform === 'win32')(
'still publishes a development checkout the user linked in, links inside it included',
async () => {
diff --git a/tests/hermes_cli/test_desktop_plugin_halves_host_fs.py b/tests/hermes_cli/test_desktop_plugin_halves_host_fs.py
index 500ffd35c2d..1c515d27c52 100644
--- a/tests/hermes_cli/test_desktop_plugin_halves_host_fs.py
+++ b/tests/hermes_cli/test_desktop_plugin_halves_host_fs.py
@@ -5,6 +5,7 @@ The host pass treats a Windows junction as the link it is, as Electron's ``lstat
``Path.is_symlink()`` is False for a junction, and a junction needs no privilege to make on Windows,
so a check that only asks ``is_symlink()`` publishes whatever folder a junction points at. The
real-junction tests run on the Windows lane; the stubbed ones run the same contract on every host.
+On macOS and Windows a ``Desktop/`` folder answers for ``desktop/``; that half must publish.
"""
import json
@@ -125,3 +126,16 @@ def test_a_plain_folder_the_host_reports_as_a_junction_at_the_target_is_left_alo
assert reconcile_desktop_halves_report(root, app_root) == {"touched": [], "refused": []}
assert (app_root / "media" / "mine.txt").read_text(encoding="utf-8") == "mine"
+
+
[email protected]("macos", "windows")
+def test_a_desktop_folder_spelled_with_a_capital_publishes_on_a_case_insensitive_volume(tmp_path):
+ root, app_root = tmp_path / "hermes", tmp_path / "hermes" / "desktop-plugins"
+ package = root / "plugins" / "media"
+ (package / "Desktop").mkdir(parents=True)
+ (package / "Desktop" / "plugin.js").write_text("export default {}", encoding="utf-8")
+ if not (package / "desktop" / "plugin.js").is_file():
+ pytest.skip("this temporary folder is on a case-sensitive volume")
+
+ assert reconcile_desktop_halves_report(root, app_root) == {"touched": [str(app_root / "media")], "refused": []}
+ assert (app_root / "media" / "plugin.js").read_text(encoding="utf-8") == "export default {}"