Compare commits
1
Commits
next
...
c07a092900
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c07a092900 |
@@ -18,6 +18,12 @@ Tag v1.0.0.
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
|
- 2026-09-22: Stopped `make test` collecting tests from checkouts nested under
|
||||||
|
`.claude/` (issue 25). vitest ignores `.gitignore` when finding tests, so a
|
||||||
|
nested checkout ran the whole suite again; `vitest.config.ts` now adds
|
||||||
|
`.claude/**` to vitest's default excludes, and
|
||||||
|
`test/packaging/nested-checkout.test.ts` plants a nested checkout in a temp
|
||||||
|
directory and fails if vitest would collect it.
|
||||||
- 2026-09-22: Rewrote the README API reference (and the Getting Started / usage
|
- 2026-09-22: Rewrote the README API reference (and the Getting Started / usage
|
||||||
snippets) to match the shipped cache/API library on `next` (issue 53, issue
|
snippets) to match the shipped cache/API library on `next` (issue 53, issue
|
||||||
13). Documented `Library.open` and its options, the default-read vs `fresh()`
|
13). Documented `Library.open` and its options, the default-read vs `fresh()`
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// A checkout nested under `.claude/` must not add its tests to this suite.
|
||||||
|
// The test plants one in a temporary directory next to a real test file and
|
||||||
|
// asks vitest, with this repo's config, which test files it would run.
|
||||||
|
import { afterEach, describe, expect, it } from "vitest";
|
||||||
|
import { execFileSync } from "node:child_process";
|
||||||
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const repoRoot = fileURLToPath(new URL("../../", import.meta.url));
|
||||||
|
|
||||||
|
let root = "";
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
rmSync(root, { recursive: true, force: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
const writeTest = (path: string): void => {
|
||||||
|
mkdirSync(join(root, path, ".."), { recursive: true });
|
||||||
|
writeFileSync(
|
||||||
|
join(root, path),
|
||||||
|
'import { it } from "vitest";\nit("runs", () => {});\n',
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("vitest.config.ts", () => {
|
||||||
|
it("does not collect tests from a checkout nested under .claude/", () => {
|
||||||
|
root = mkdtempSync(join(tmpdir(), "quak-nested-checkout-"));
|
||||||
|
writeTest("test/real.test.ts");
|
||||||
|
writeTest(".claude/worktrees/other/test/real.test.ts");
|
||||||
|
|
||||||
|
const output = execFileSync(
|
||||||
|
process.execPath,
|
||||||
|
[
|
||||||
|
join(repoRoot, "node_modules/vitest/vitest.mjs"),
|
||||||
|
"list",
|
||||||
|
"--filesOnly",
|
||||||
|
"--config",
|
||||||
|
join(repoRoot, "vitest.config.ts"),
|
||||||
|
"--root",
|
||||||
|
root,
|
||||||
|
],
|
||||||
|
{ cwd: root, encoding: "utf-8" },
|
||||||
|
);
|
||||||
|
|
||||||
|
const files = output.split("\n").filter((line) => line !== "");
|
||||||
|
expect(files).toEqual(["test/real.test.ts"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { configDefaults, defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
// vitest does not read .gitignore when looking for tests. A checkout nested
|
||||||
|
// under .claude/ has its own test/ tree, and without this exclude the suite
|
||||||
|
// runs once per nested checkout and still reports success.
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
exclude: [...configDefaults.exclude, ".claude/**"],
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user