-
Notifications
You must be signed in to change notification settings - Fork 750
Expand file tree
/
Copy pathconfig_test.ts
More file actions
26 lines (22 loc) · 974 Bytes
/
config_test.ts
File metadata and controls
26 lines (22 loc) · 974 Bytes
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
import { expect } from "@std/expect";
import { fresh } from "../src/mod.ts";
import type { Plugin } from "vite";
Deno.test("fresh plugin - sets server.watch.ignored patterns", () => {
const plugins = fresh() as Plugin[];
const freshPlugin = plugins.find((p) => p.name === "fresh");
expect(freshPlugin).toBeDefined();
// Call the config hook as Vite would during dev
// deno-lint-ignore no-explicit-any
const configFn = freshPlugin!.config as any;
const result = configFn({}, { command: "serve" });
const ignored = result?.server?.watch?.ignored;
expect(ignored).toBeDefined();
expect(Array.isArray(ignored)).toBe(true);
// Should ignore temp files, editor swap files, and Vite timestamp files
expect(ignored).toContain("**/*.tmp.*");
expect(ignored).toContain("**/*.timestamp-*");
expect(ignored).toContain("**/*.swp");
expect(ignored).toContain("**/*.swo");
expect(ignored).toContain("**/*~");
expect(ignored).toContain("**/.#*");
});