File tree Expand file tree Collapse file tree
packages/plugin-vite/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments