@@ -3,56 +3,14 @@ import { runInlineTests } from '../../test-utils'
33
44const ts = String . raw
55
6- test ( 'reruns tests when configs change' , async ( ) => {
7- const { fs, vitest } = await runInlineTests ( {
8- 'vitest.workspace.ts' : [
9- './project-1' ,
10- './project-2' ,
11- ] ,
12- 'vitest.config.ts' : { } ,
13- 'project-1/vitest.config.ts' : { } ,
14- 'project-1/basic.test.ts' : ts `
15- import { test } from 'vitest'
16- test('basic test 1', () => {})
17- ` ,
18- 'project-2/vitest.config.ts' : { } ,
19- 'project-2/basic.test.ts' : ts `
20- import { test } from 'vitest'
21- test('basic test 2', () => {})
22- ` ,
23- } , { watch : true } )
24-
25- await vitest . waitForStdout ( 'Waiting for file changes' )
26- vitest . resetOutput ( )
27-
28- // editing the project config should trigger a restart
29- fs . editFile ( './project-1/vitest.config.ts' , c => `\n${ c } ` )
30-
31- await vitest . waitForStdout ( 'Restarting due to config changes...' )
32- await vitest . waitForStdout ( 'Waiting for file changes' )
33- vitest . resetOutput ( )
34-
35- // editing the root config should trigger a restart
36- fs . editFile ( './vitest.config.ts' , c => `\n${ c } ` )
37-
38- await vitest . waitForStdout ( 'Restarting due to config changes...' )
39- await vitest . waitForStdout ( 'Waiting for file changes' )
40- vitest . resetOutput ( )
41-
42- // editing the workspace config should trigger a restart
43- fs . editFile ( './vitest.workspace.ts' , c => `\n${ c } ` )
44-
45- await vitest . waitForStdout ( 'Restarting due to config changes...' )
46- await vitest . waitForStdout ( 'Waiting for file changes' )
47- } )
48-
496test ( 'rerun stops the previous browser server and restarts multiple times without port mismatch' , async ( ) => {
507 const { fs, vitest } = await runInlineTests ( {
51- 'vitest.workspace.ts' : [
52- './project-1' ,
53- ] ,
54- 'vitest.config.ts' : { } ,
55- 'project-1/vitest.config.ts' : {
8+ 'vitest.config.js' : {
9+ test : {
10+ projects : [ './project-1' ] ,
11+ } ,
12+ } ,
13+ 'project-1/vitest.config.js' : {
5614 test : {
5715 browser : {
5816 enabled : true ,
@@ -72,7 +30,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
7230 vitest . resetOutput ( )
7331
7432 // editing the project config the first time restarts the browser server
75- fs . editFile ( './project-1/vitest.config.ts ' , c => `\n${ c } ` )
33+ fs . editFile ( './project-1/vitest.config.js ' , c => `\n${ c } ` )
7634
7735 await vitest . waitForStdout ( 'Restarting due to config changes...' )
7836 await vitest . waitForStdout ( 'Waiting for file changes' )
@@ -82,7 +40,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
8240 vitest . resetOutput ( )
8341
8442 // editing the project the second time also restarts the server
85- fs . editFile ( './project-1/vitest.config.ts ' , c => `\n${ c } ` )
43+ fs . editFile ( './project-1/vitest.config.js ' , c => `\n${ c } ` )
8644
8745 await vitest . waitForStdout ( 'Restarting due to config changes...' )
8846 await vitest . waitForStdout ( 'Waiting for file changes' )
0 commit comments