ignore: improve file ignore performance and cross-platform support

- Replace glob patterns with Set lookup for common folders to speed up matching
- Use path.sep for cross-platform compatibility on Windows/Unix systems
- Add comprehensive test coverage for nested and non-nested folder matching
- Simplify implementation by removing unnecessary caching complexity
This commit is contained in:
Dax Raad
2025-10-09 15:53:45 -04:00
parent c2950d26f0
commit dfc7ac4cf0
2 changed files with 43 additions and 28 deletions

View File

@@ -0,0 +1,10 @@
import { test, expect } from "bun:test"
import { FileIgnore } from "../../src/file/ignore"
test("match nested and non-nested", () => {
expect(FileIgnore.match("node_modules/index.js")).toBe(true)
expect(FileIgnore.match("node_modules")).toBe(true)
expect(FileIgnore.match("node_modules/")).toBe(true)
expect(FileIgnore.match("node_modules/bar")).toBe(true)
expect(FileIgnore.match("node_modules/bar/")).toBe(true)
})