Skip to content

Commit ac6fcd3

Browse files
bartlomiejuclaude
andcommitted
test: verify server.watch.ignored patterns in Fresh Vite plugin
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9d8003c commit ac6fcd3

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { expect } from "@std/expect";
2+
import { fresh } from "../src/mod.ts";
3+
import type { Plugin } from "vite";
4+
5+
Deno.test("fresh plugin - sets server.watch.ignored patterns", () => {
6+
const plugins = fresh() as Plugin[];
7+
const freshPlugin = plugins.find((p) => p.name === "fresh");
8+
expect(freshPlugin).toBeDefined();
9+
10+
// Call the config hook as Vite would during dev
11+
// deno-lint-ignore no-explicit-any
12+
const configFn = freshPlugin!.config as any;
13+
const result = configFn({}, { command: "serve" });
14+
15+
const ignored = result?.server?.watch?.ignored;
16+
expect(ignored).toBeDefined();
17+
expect(Array.isArray(ignored)).toBe(true);
18+
19+
// Should ignore temp files, editor swap files, and Vite timestamp files
20+
expect(ignored).toContain("**/*.tmp.*");
21+
expect(ignored).toContain("**/*.timestamp-*");
22+
expect(ignored).toContain("**/*.swp");
23+
expect(ignored).toContain("**/*.swo");
24+
expect(ignored).toContain("**/*~");
25+
expect(ignored).toContain("**/.#*");
26+
});

0 commit comments

Comments
 (0)