@@ -12,6 +12,9 @@ const testFileContent = readFileSync(testFile, 'utf-8')
1212const configFile = 'fixtures/vitest.config.ts'
1313const configFileContent = readFileSync ( configFile , 'utf-8' )
1414
15+ const forceTriggerFile = 'fixtures/force-watch/trigger.js'
16+ const forceTriggerFileContent = readFileSync ( forceTriggerFile , 'utf-8' )
17+
1518const cliArgs = [ '--root' , 'fixtures' , '--watch' ]
1619const cleanups : ( ( ) => void ) [ ] = [ ]
1720
@@ -26,6 +29,7 @@ afterEach(() => {
2629 writeFileSync ( sourceFile , sourceFileContent , 'utf8' )
2730 writeFileSync ( testFile , testFileContent , 'utf8' )
2831 writeFileSync ( configFile , configFileContent , 'utf8' )
32+ writeFileSync ( forceTriggerFile , forceTriggerFileContent , 'utf8' )
2933 cleanups . splice ( 0 ) . forEach ( cleanup => cleanup ( ) )
3034} )
3135
@@ -39,6 +43,18 @@ test('editing source file triggers re-run', async () => {
3943 await vitest . waitForStdout ( '1 passed' )
4044} )
4145
46+ test ( 'editing force rerun trigger reruns all tests' , async ( ) => {
47+ const vitest = await runVitestCli ( ...cliArgs )
48+
49+ writeFileSync ( forceTriggerFile , editFile ( forceTriggerFileContent ) , 'utf8' )
50+
51+ await vitest . waitForStdout ( 'Waiting for file changes...' )
52+ await vitest . waitForStdout ( 'RERUN ../force-watch/trigger.js' )
53+ await vitest . waitForStdout ( 'example.test.ts' )
54+ await vitest . waitForStdout ( 'math.test.ts' )
55+ await vitest . waitForStdout ( '2 passed' )
56+ } )
57+
4258test ( 'editing test file triggers re-run' , async ( ) => {
4359 const vitest = await runVitestCli ( ...cliArgs )
4460
0 commit comments