| 1 | import { describe, expect, it } from "bun:test"; |
| 2 | import ignore, { isPathValid } from "../src/ignore.ts"; |
| 3 | |
| 4 | describe("module exports", () => { |
| 5 | it("supports the upstream default and named import surface", () => { |
| 6 | const matcher = ignore().add("*").add(["!*/", "!foo/bar"]); |
| 7 | |
| 8 | expect(matcher.createFilter()("a")).toBe(false); |
| 9 | expect(matcher.filter(["a", "a/b", "foo/bar"])).toEqual(["foo/bar"]); |
| 10 | expect(matcher.ignores("a")).toBe(true); |
| 11 | expect(isPathValid("./foo")).toBe(false); |
| 12 | matcher.add({ pattern: "foo/*", mark: "10" }); |
| 13 | expect(matcher.checkIgnore("foo/").rule?.mark).toBe("10"); |
| 14 | }); |
| 15 | }); |