From 95eb4bcf40e62a5f22434fe9feaa2ba6f1b0845d Mon Sep 17 00:00:00 2001 From: Tianyi Cui <53024+tianyicui@users.noreply.github.com> Date: Sun, 9 Aug 2026 17:20:58 +0800 Subject: [PATCH] test(windows): vary HMR polling writes --- packages/boot/app-boot/tests/hmr-config.spec.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/boot/app-boot/tests/hmr-config.spec.ts b/packages/boot/app-boot/tests/hmr-config.spec.ts index dbb3a8ca83..d21e222104 100644 --- a/packages/boot/app-boot/tests/hmr-config.spec.ts +++ b/packages/boot/app-boot/tests/hmr-config.spec.ts @@ -48,9 +48,13 @@ describe('HMR exact config paths', () => { try { const deadline = Date.now() + 20_000 for (let generation = 1; !observed.includes(expected); generation += 1) { - if (Date.now() >= deadline) throw new Error('HMR did not observe a module change through the alias') + if (Date.now() >= deadline) { + throw new Error(`HMR did not observe ${expected} through the alias; observed ${JSON.stringify(observed)}`) + } // The watch base, not the writer spelling, is the alias under test. - writeFileSync(filename, `export const generation = ${generation}\n`) + // Grow the file on every write: polling must not depend on timestamp + // precision when several generations land inside one filesystem tick. + writeFileSync(filename, `export const generation = ${generation}\n${' '.repeat(generation)}\n`) // Leave Chokidar's atomic-write window idle so one coalesced change can publish. await new Promise(resolve => setTimeout(resolve, 250)) }