@@ -12,6 +12,9 @@ const testFileContent = readFileSync(testFile, 'utf-8')
12
12
const configFile = 'fixtures/vitest.config.ts'
13
13
const configFileContent = readFileSync ( configFile , 'utf-8' )
14
14
15
+ const forceTriggerFile = 'fixtures/force-watch/trigger.js'
16
+ const forceTriggerFileContent = readFileSync ( forceTriggerFile , 'utf-8' )
17
+
15
18
const cliArgs = [ '--root' , 'fixtures' , '--watch' ]
16
19
const cleanups : ( ( ) => void ) [ ] = [ ]
17
20
@@ -26,6 +29,7 @@ afterEach(() => {
26
29
writeFileSync ( sourceFile , sourceFileContent , 'utf8' )
27
30
writeFileSync ( testFile , testFileContent , 'utf8' )
28
31
writeFileSync ( configFile , configFileContent , 'utf8' )
32
+ writeFileSync ( forceTriggerFile , forceTriggerFileContent , 'utf8' )
29
33
cleanups . splice ( 0 ) . forEach ( cleanup => cleanup ( ) )
30
34
} )
31
35
@@ -39,6 +43,18 @@ test('editing source file triggers re-run', async () => {
39
43
await vitest . waitForStdout ( '1 passed' )
40
44
} )
41
45
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
+
42
58
test ( 'editing test file triggers re-run' , async ( ) => {
43
59
const vitest = await runVitestCli ( ...cliArgs )
44
60
0 commit comments