[PR #4099] [MERGED] test: flaky becase cleanup function not called #5189

Closed
opened 2026-03-13 12:13:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4099
Author: @himself65
Created: 8/20/2025
Status: Merged
Merged: 8/20/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/08/19/cleanup


📝 Commits (3)

📊 Changes

1 file changed (+17 additions, -4 deletions)

View changed files

📝 packages/better-auth/src/test-utils/test-instance.ts (+17 -4)

📄 Description

Fixes: https://github.com/better-auth/better-auth/issues/4097

Asked vitest member, we did wrong

image

Summary by cubic

Make test cleanup reliable by calling a shared cleanup function via onTestFinished with a fallback to afterAll. Also stress-runs the getSessionCookie suite (repeats: 100) and enables debug logging to surface flakiness. Fixes better-auth/better-auth#4097.

  • Bug Fixes
    • Register a reusable cleanup that drops databases and deletes temp files using onTestFinished, falling back to afterAll.
    • Repeat getSessionCookie tests 100x to catch intermittent failures.
    • Set test logger level to debug for easier debugging.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4099 **Author:** [@himself65](https://github.com/himself65) **Created:** 8/20/2025 **Status:** ✅ Merged **Merged:** 8/20/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/08/19/cleanup` --- ### 📝 Commits (3) - [`bf1e3c0`](https://github.com/better-auth/better-auth/commit/bf1e3c055152f1c6a0eafcad66034832b2b32685) test: call cleanup function - [`2dd2780`](https://github.com/better-auth/better-auth/commit/2dd2780d92f64d0db04203aeb5f10d51e148cab6) fixup! - [`b2ca403`](https://github.com/better-auth/better-auth/commit/b2ca40389dedd21d34c7b58cb111cffe6aa152a9) fixup! ### 📊 Changes **1 file changed** (+17 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/test-utils/test-instance.ts` (+17 -4) </details> ### 📄 Description Fixes: https://github.com/better-auth/better-auth/issues/4097 Asked vitest member, we did wrong <img width="562" height="476" alt="image" src="https://github.com/user-attachments/assets/28165617-1951-4910-8b90-39e0c9db6013" /> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Make test cleanup reliable by calling a shared cleanup function via onTestFinished with a fallback to afterAll. Also stress-runs the getSessionCookie suite (repeats: 100) and enables debug logging to surface flakiness. Fixes better-auth/better-auth#4097. - **Bug Fixes** - Register a reusable cleanup that drops databases and deletes temp files using onTestFinished, falling back to afterAll. - Repeat getSessionCookie tests 100x to catch intermittent failures. - Set test logger level to debug for easier debugging. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:13:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5189