-
Notifications
You must be signed in to change notification settings - Fork 432
Expand file tree
/
Copy pathproject-ai-config.test.ts
More file actions
53 lines (49 loc) · 1.85 KB
/
project-ai-config.test.ts
File metadata and controls
53 lines (49 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* project-ai-config.test.ts
*
* Verifies that AI assistant configuration files (CLAUDE.md, AGENTS.md)
* are properly excluded from project file discovery and rendering.
*
* Copyright (C) 2020-2025 Posit Software, PBC
*/
import { docs } from "../../utils.ts";
import { join } from "../../../src/deno_ral/path.ts";
import { existsSync } from "../../../src/deno_ral/fs.ts";
import { removeIfExists } from "../../../src/core/path.ts";
import { testQuartoCmd } from "../../test.ts";
import { fileExists, pathDoNotExists, noErrors } from "../../verify.ts";
const projectDir = docs("project/ai-config-files");
const outputDir = join(projectDir, "_site");
// .local.md fixture files are created at runtime to avoid .gitignore conflicts
const localFiles = ["CLAUDE.local.md", "AGENTS.local.md"];
// Test that AI assistant config files are properly excluded
testQuartoCmd(
"render",
[projectDir],
[
noErrors,
fileExists(join(outputDir, "index.html")), // Control: regular file should be rendered
pathDoNotExists(join(outputDir, "CLAUDE.html")), // CLAUDE.md should be ignored
pathDoNotExists(join(outputDir, "AGENTS.html")), // AGENTS.md should be ignored
pathDoNotExists(join(outputDir, "CLAUDE.local.html")), // CLAUDE.local.md should be ignored
pathDoNotExists(join(outputDir, "AGENTS.local.html")), // AGENTS.local.md should be ignored
],
{
setup: async () => {
for (const file of localFiles) {
await Deno.writeTextFile(
join(projectDir, file),
"This is a local AI config file that should be ignored during project scanning.\n",
);
}
},
teardown: async () => {
for (const file of localFiles) {
removeIfExists(join(projectDir, file));
}
if (existsSync(outputDir)) {
await Deno.remove(outputDir, { recursive: true });
}
},
},
);