File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { join } from 'node:path' ;
2+ import { loadConfigFromFile } from 'vite-plus' ;
3+ import { expect , it } from 'vite-plus/test' ;
4+ import { parseCLI } from 'vite-plus/test/node' ;
5+
6+ it ( 'keeps a forwarded filename as a filter for the native iteration command' , async ( ) => {
7+ const loaded = await loadConfigFromFile (
8+ { command : 'serve' , mode : 'test' } ,
9+ join ( import . meta. dirname , '../../../../vite.config.ts' ) ,
10+ ) ;
11+ const task = loaded ?. config . run ?. tasks ?. [ 'test:iterate' ] ;
12+ if (
13+ ! task ||
14+ typeof task !== 'object' ||
15+ ! ( 'command' in task ) ||
16+ typeof task . command !== 'string'
17+ ) {
18+ throw new Error ( 'Expected a native Vitest command' ) ;
19+ }
20+ const file = 'packages/void/test/unit/plugin-routing.test.ts' ;
21+ const { filter, options } = parseCLI (
22+ `${ task . command . replace ( / ^ v p t e s t / , 'vitest' ) } ${ file } --project unit` ,
23+ ) ;
24+ expect ( filter ) . toEqual ( [ file ] ) ;
25+ expect ( options . sinceLastRun ) . toBeTruthy ( ) ;
26+ expect ( options . project ) . toEqual ( [ 'unit' ] ) ;
27+ } ) ;
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export default defineConfig({
110110 ] ,
111111 } ,
112112 test : { command : 'node test/affected.mjs' , cache : false } ,
113- 'test:iterate' : { command : 'vp test run --since-last-run' , cache : false } ,
113+ 'test:iterate' : { command : 'vp test run --since-last-run=true ' , cache : false } ,
114114 'test:benchmark' : {
115115 command : 'vp test run --reporter=default --reporter=./test/performance-reporter.ts' ,
116116 cache : false ,
You can’t perform that action at this time.
0 commit comments