From 7a67ada8b1f60d068ce048c9099db6005fb7a08d Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:04:24 -0800 Subject: [PATCH] test(watchers): make simulated macOS paths portable --- .../macos-protected-watch-exclusions.test.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/main/ipc/filesystem/watcher-process/root-paths/macos-protected-watch-exclusions.test.ts b/src/main/ipc/filesystem/watcher-process/root-paths/macos-protected-watch-exclusions.test.ts index 45097310490..e5f6d8a301b 100644 --- a/src/main/ipc/filesystem/watcher-process/root-paths/macos-protected-watch-exclusions.test.ts +++ b/src/main/ipc/filesystem/watcher-process/root-paths/macos-protected-watch-exclusions.test.ts @@ -1,4 +1,5 @@ import type * as NodeOs from 'node:os' +import type * as NodePath from 'node:path' import { describe, expect, it, vi } from 'vitest' const osMock = vi.hoisted(() => ({ @@ -10,6 +11,7 @@ vi.mock('node:os', async (importOriginal) => ({ homedir: () => osMock.homedir(), userInfo: () => osMock.userInfo() })) +vi.mock('node:path', async (importOriginal) => (await importOriginal()).posix) import { WATCHER_IGNORE_DIRS, buildParcelWatcherIgnoreOptions @@ -129,17 +131,6 @@ describe('withMacosProtectedWatchExclusions', () => { ).toBe(base) }) - it('adds literal paths and keeps the native exclusion total at eight', () => { - const opts = withMacosProtectedWatchExclusions('/', base, { - ...darwin, - homes: ['/profiles/p1', '/Users/me'] - }) - expect(opts.ignorePaths).toEqual(['/profiles/p1/Library', '/Users/me/Library']) - expect((opts.ignorePaths?.length ?? 0) + (opts.ignore?.length ?? 0)).toBe(8) - // Names past the native cap stay covered by the unchanged nested-name regex. - expect(opts.ignoreGlobs).toEqual(base.ignoreGlobs) - }) - it('leaves shallow subscriptions alone', () => { const shallow = { mode: 'shallow' as const, include: ['a'] } expect(