@@ -2,7 +2,7 @@ import { exec, spawn } from 'node:child_process';
22import path from 'node:path' ;
33import { after } from 'node:test' ;
44import fse from 'fs-extra' ;
5- import { awaitFileChanges , awaitFileExists } from 'test-helper' ;
5+ import { expectFile , expectFileChanges } from 'test-helper' ;
66import { describe , expect , test } from 'vitest' ;
77
88describe ( 'build --watch command' , async ( ) => {
@@ -30,7 +30,7 @@ export default defineConfig({
3030 cwd : __dirname ,
3131 } ) ;
3232
33- await awaitFileExists ( distEsmIndexFile ) ;
33+ await expectFile ( distEsmIndexFile ) ;
3434
3535 fse . outputFileSync (
3636 tempConfigFile ,
@@ -49,7 +49,7 @@ export default defineConfig({
4949 ` ,
5050 ) ;
5151
52- await awaitFileExists ( dist1EsmIndexFile ) ;
52+ await expectFile ( dist1EsmIndexFile ) ;
5353
5454 process . kill ( ) ;
5555 } ) ;
@@ -103,12 +103,12 @@ export default defineConfig({
103103 shell : true ,
104104 } ,
105105 ) ;
106- await awaitFileExists ( distIndexFile ) ;
106+ await expectFile ( distIndexFile ) ;
107107
108108 fse . outputFileSync ( srcFooFile , `export const foo = 'foo';` ) ;
109109 fse . outputFileSync ( srcFoo2File , `export const foo2 = 'foo2';` ) ;
110- await awaitFileExists ( distFooFile ) ;
111- await awaitFileExists ( distFoo2File ) ;
110+ await expectFile ( distFooFile ) ;
111+ await expectFile ( distFoo2File ) ;
112112 const content1 = await fse . readFile ( distFooFile , 'utf-8' ) ;
113113 expect ( content1 ! ) . toMatchInlineSnapshot ( `
114114 "const foo = 'foo';
@@ -127,7 +127,7 @@ export default defineConfig({
127127 fse . removeSync ( srcIndexFile ) ;
128128
129129 // change
130- const wait = await awaitFileChanges ( distFooFile ) ;
130+ const wait = await expectFileChanges ( distFooFile ) ;
131131 fse . outputFileSync ( srcFooFile , `export const foo = 'foo1';` ) ;
132132 await wait ( ) ;
133133 const content3 = await fse . readFile ( distFooFile , 'utf-8' ) ;
0 commit comments