Skip to content

Commit 29523c8

Browse files
committed
chore: update
1 parent e0d81ee commit 29523c8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/integration/cli/build-watch/build.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export default defineConfig({
127127
fse.removeSync(srcIndexFile);
128128

129129
// change
130-
const wait = await awaitFileChanges(distFooFile);
130+
const wait = await awaitFileChanges(distFooFile, 'foo1');
131131
fse.outputFileSync(srcFooFile, `export const foo = 'foo1';`);
132132
await wait();
133133
const content3 = await fse.readFile(distFooFile, 'utf-8');

tests/scripts/helper.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,16 @@ export const awaitFileExists = async (dir: string) => {
9595
}
9696
};
9797

98-
export const awaitFileChanges = async (file: string) => {
98+
export const awaitFileChanges = async (file: string, content: string) => {
9999
const oldContent = await fse.readFile(file, 'utf-8');
100100
return async () => {
101101
const result = await waitFor(
102102
() => {
103103
try {
104-
return fse.readFileSync(file, 'utf-8') !== oldContent;
104+
return (
105+
fse.readFileSync(file, 'utf-8') !== oldContent &&
106+
fse.readFileSync(file, 'utf-8').includes(content)
107+
);
105108
} catch (e) {
106109
return false;
107110
}

0 commit comments

Comments
 (0)