mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 11:24:37 +00:00
test(watchers): make simulated macOS paths portable
This commit is contained in:
+2
-11
@@ -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<typeof NodePath>()).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(
|
||||
|
||||
Reference in New Issue
Block a user