// @vitest-environment node import { execFileSync } from "node:child_process"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const repo = resolve(dirname(fileURLToPath(import.meta.url)), ".."); describe("the .gitignore rules", () => { // A tracked file that an ignore rule matches goes missing when the sources are added to a // new repository (a source archive, a fresh `git add`). it("match no tracked file", () => { const tracked = execFileSync("git", ["ls-files", "--cached", "--ignored", "--exclude-standard"], { cwd: repo, encoding: "utf8", }); expect(tracked.split("\n").filter(Boolean)).toEqual([]); }); });