Skip to content

test(e2e): fix flaky idle hydration strategy test#14735

Merged
edison1105 merged 1 commit into
vuejs:mainfrom
babu-ch:fix/hydration-strat-idle-flaky
Apr 22, 2026
Merged

test(e2e): fix flaky idle hydration strategy test#14735
edison1105 merged 1 commit into
vuejs:mainfrom
babu-ch:fix/hydration-strat-idle-flaky

Conversation

@babu-ch
Copy link
Copy Markdown
Contributor

@babu-ch babu-ch commented Apr 17, 2026

The idle test in hydrationStrategies.spec.ts is flaky — the loader's setTimeout(10) can complete before the test asserts isHydrated === false.

Let the test control when the loader starts via window.resolveLoader().

Found while investigating CI failures in #14549.

Summary by CodeRabbit

  • Tests
    • Updated e2e test harness to support external triggering of async component loading.
    • Enhanced hydration strategy tests to verify component hydration behavior under controlled loading scenarios.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 744a15d2-1274-4697-9737-88b296e67635

📥 Commits

Reviewing files that changed from the base of the PR and between 7df0edd and d475587.

📒 Files selected for processing (2)
  • packages/vue/__tests__/e2e/hydration-strat-idle.html
  • packages/vue/__tests__/e2e/hydrationStrategies.spec.ts

📝 Walkthrough

Walkthrough

The changes introduce an externally callable window.resolveLoader() hook in the hydration idle e2e test that defers async component resolution until explicitly invoked, enabling precise control over component loading timing in tests.

Changes

Cohort / File(s) Summary
Async Loader Hook
packages/vue/__tests__/e2e/hydration-strat-idle.html
Added window.resolveLoader function that wraps the previous setTimeout + component resolution + requestIdleCallback flow, deferring execution until the hook is called.
Test Harness & Invocation
packages/vue/__tests__/e2e/hydrationStrategies.spec.ts
Extended window type declaration with resolveLoader: () => void property and added explicit invocation of window.resolveLoader() in the idle test case after verifying initial non-hydrated state.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

ready to merge, scope:hydration

Poem

🐰 A loader waits upon my call,
No rush, no eager resolve at all,
I hold the reins, I choose when done,
Hydration dances, test by test, one by one!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing a flaky e2e test for the idle hydration strategy by introducing explicit control over loader timing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 105 kB 39.9 kB 35.8 kB
vue.global.prod.js 164 kB 59.9 kB 53.2 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.3 kB 18.8 kB 17.2 kB
createApp 56.5 kB 21.8 kB 20 kB
createSSRApp 60.7 kB 23.6 kB 21.5 kB
defineCustomElement 62.6 kB 23.8 kB 21.7 kB
overall 71 kB 27.2 kB 24.7 kB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 17, 2026

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@14735
npm i https://pkg.pr.new/@vue/compiler-core@14735
yarn add https://pkg.pr.new/@vue/compiler-core@14735.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@14735
npm i https://pkg.pr.new/@vue/compiler-dom@14735
yarn add https://pkg.pr.new/@vue/compiler-dom@14735.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@14735
npm i https://pkg.pr.new/@vue/compiler-sfc@14735
yarn add https://pkg.pr.new/@vue/compiler-sfc@14735.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@14735
npm i https://pkg.pr.new/@vue/compiler-ssr@14735
yarn add https://pkg.pr.new/@vue/compiler-ssr@14735.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@14735
npm i https://pkg.pr.new/@vue/reactivity@14735
yarn add https://pkg.pr.new/@vue/reactivity@14735.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@14735
npm i https://pkg.pr.new/@vue/runtime-core@14735
yarn add https://pkg.pr.new/@vue/runtime-core@14735.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@14735
npm i https://pkg.pr.new/@vue/runtime-dom@14735
yarn add https://pkg.pr.new/@vue/runtime-dom@14735.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@14735
npm i https://pkg.pr.new/@vue/server-renderer@14735
yarn add https://pkg.pr.new/@vue/server-renderer@14735.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@14735
npm i https://pkg.pr.new/@vue/shared@14735
yarn add https://pkg.pr.new/@vue/shared@14735.tgz

vue

pnpm add https://pkg.pr.new/vue@14735
npm i https://pkg.pr.new/vue@14735
yarn add https://pkg.pr.new/vue@14735.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@14735
npm i https://pkg.pr.new/@vue/compat@14735
yarn add https://pkg.pr.new/@vue/compat@14735.tgz

commit: d475587

@babu-ch babu-ch marked this pull request as ready for review April 17, 2026 14:28
@babu-ch
Copy link
Copy Markdown
Contributor Author

babu-ch commented Apr 17, 2026

@edison1105 coud you take a look?

@edison1105 edison1105 merged commit e168d62 into vuejs:main Apr 22, 2026
14 checks passed
@babu-ch babu-ch deleted the fix/hydration-strat-idle-flaky branch April 23, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants