diff --git a/playground/hmr-ssr/__tests__/hmr-ssr.spec.ts b/playground/hmr-ssr/__tests__/hmr-ssr.spec.ts index b3654d6ebdc29a..59ab99c685981b 100644 --- a/playground/hmr-ssr/__tests__/hmr-ssr.spec.ts +++ b/playground/hmr-ssr/__tests__/hmr-ssr.spec.ts @@ -824,22 +824,29 @@ if (!isBuild) { const parentFile = 'file-delete-restore/parent.js' const childFile = 'file-delete-restore/child.js' + const originalChildFileCode = readFile(childFile) - // delete the file - editFile(parentFile, (code) => - code.replace( - "export { value as childValue } from './child'", - "export const childValue = 'not-child'", - ), + await untilConsoleLogAfter( + () => { + // delete the file + editFile(parentFile, (code) => + code.replace( + "export { value as childValue } from './child'", + "export const childValue = 'not-child'", + ), + ) + removeFile(childFile) + }, + [ + 'file-delete-restore/child.js is disposed', + 'file-delete-restore/child.js is pruned', + ], + false, ) - const originalChildFileCode = readFile(childFile) - removeFile(childFile) await expect .poll(() => hmr('.file-delete-restore')) .toMatch('parent:not-child') - expect(clientLogs).to.include('file-delete-restore/child.js is disposed') - expect(clientLogs).to.include('file-delete-restore/child.js is pruned') // restore the file addFile(childFile, originalChildFileCode)