test(editor): reduce flaky in turbo renderer test#11973
Conversation
WalkthroughThe test suite for the viewport turbo renderer was updated to improve resource cleanup management by declaring the cleanup function at the describe block scope and assigning it within the beforeEach hook. An afterEach hook was added to explicitly invoke the cleanup function after each test, ensuring proper teardown. Additionally, optional chaining was added to safely call Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
blocksuite/integration-test/src/__tests__/edgeless/turbo-renderer.spec.ts(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
blocksuite/integration-test/src/__tests__/edgeless/turbo-renderer.spec.ts (1)
blocksuite/integration-test/src/__tests__/utils/setup.ts (1)
setupEditor(118-135)
🔇 Additional comments (4)
blocksuite/integration-test/src/__tests__/edgeless/turbo-renderer.spec.ts (4)
10-10: Import of afterEach for explicit cleanup.Added the
afterEachimport to support the new cleanup approach.
21-22: Improved test cleanup reliability by declaring cleanup at describe scope.Moving the cleanup function declaration to the describe block scope ensures it's accessible to all test lifecycle hooks, which helps address potential flakiness issues.
24-24: Using outer cleanup variable to ensure resource management.Now storing the cleanup function in the outer scope variable rather than a local one, ensuring it's properly persisted between hooks.
34-35: Added explicit afterEach hook to ensure consistent cleanup.This is a good practice that ensures resources are properly released after each test, which helps prevent test flakiness caused by resource leaks or interference between tests.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## canary #11973 +/- ##
=======================================
Coverage 55.87% 55.87%
=======================================
Files 2599 2599
Lines 115345 115345
Branches 18552 18552
=======================================
+ Hits 64449 64450 +1
Misses 48907 48907
+ Partials 1989 1988 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merge activity
|
16ecaa8 to
1113cd7
Compare
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Improved test resource cleanup for the viewport turbo renderer, ensuring proper teardown after each test for more reliable and isolated test execution. - Enhanced stability by preventing errors during cleanup when certain elements or editors are absent. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1113cd7 to
a46f1a3
Compare

Summary by CodeRabbit