glob.test.ts
This file
Path
packages/gate/test/glob.test.ts
40 lines · 1.5 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–40why, one step back1import { describe, expect, it } from "@effect/vitest";23import { matchAny, matchGlob } from "../src/glob.ts";45const rows: readonly (readonly [string, string, boolean])[] = [6 ["vitest.config.*", "vitest.config.ts", true],7 ["vitest.config.*", "packages/parse/vitest.config.ts", true],8 [".github/workflows/**", ".github/workflows/ci.yml", true],9 [".github/workflows/**", "docs/.github/workflows/ci.yml", false],10 ["/package.json", "package.json", true],11 ["/package.json", "packages/parse/package.json", false],12 ["tools/oxlint/**", "tools/oxlint", true],13 ["packages/*/src/**", "packages/parse/src/week.ts", true],14 ["packages/*/src/**", "packages/parse/test/week.test.ts", false],15 ["a/**/b", "a/b", true],16 ["a/**/b", "a/x/y/b", true],17 ["tsconfig*.json", "packages/parse/tsconfig.build.json", true],18 ["generated/", "generated/skill.md", true],19 ["generated/", "packages/parse/generated/skill.md", true],20 ["generated/", "packages/parse/generated.ts", false],21 ["docs/generated/", "docs/generated/skill.md", true],22 ["docs/generated/", "packages/docs/generated/skill.md", false],23];2425describe(matchGlob, () => {26 it.each(rows)("%s against %s is %s", (glob, path, matches) => {27 expect(matchGlob(glob, path)).toBe(matches);28 });29});3031describe(matchAny, () => {32 it("takes back out what a !glob names", () => {33 const env = [".env.*", "!.env.*.local"];3435 expect([36 matchAny(env, ".env.production"),37 matchAny(env, "apps/web/.env.production.local"),38 ]).toStrictEqual([true, false]);39 });40});