// scripts/test-files.mjs: a test file named by a path with glob characters // ([slug]) runs, and a run of nothing fails. Run with: pnpm test:scripts import assert from "node:assert/strict"; import test from "node:test"; import { literalGlob, testsRan } from "./test-files.mjs"; test("a Next route path is escaped to match only itself", () => { assert.equal(literalGlob("app/channels/[slug]/videos/a.test.ts"), "app/channels/[[]slug]/videos/a.test.ts"); assert.equal(literalGlob("app/(group)/x?.test.ts"), "app/[(]group[)]/x[?].test.ts"); assert.equal(literalGlob("lib/plain.test.ts"), "lib/plain.test.ts"); }); test("the run's own summary is what counts, and 0 is no run", () => { assert.equal(testsRan("TAP version 13\n# tests 0\n# pass 0\n"), 0); assert.equal(testsRan("ok 1 - x\n # tests 9\n# tests 4\n# pass 4\n"), 4); assert.equal(testsRan("nothing here"), null); });