[PR #309] [MERGED] feat: set up react testing suite #1223

Closed
opened 2026-03-14 09:25:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/309
Author: @msmps
Created: 11/12/2025
Status: Merged
Merged: 11/12/2025
Merged by: @kommander

Base: mainHead: feat/add-react-test-suite-20251112171051


📝 Commits (7)

  • bbcb0f3 Update React package with test-utils and layout tests
  • a51fa60 chore: update workflow to run tests
  • 7f825c6 refactor: update import path for testRender in layout tests
  • a56ee22 chore: add zig setup step to build workflow
  • 1708c56 refactor: remove unnecessary blank lines in extmarks multiwidth tests
  • 83fe2df chore: simplify build command in React workflow
  • d34410d chore: update React workflow job name to reflect testing

📊 Changes

10 files changed (+703 additions, -26 deletions)

View changed files

📝 .github/workflows/build-react.yml (+12 -2)
📝 package.json (+1 -1)
📝 packages/core/src/lib/extmarks-multiwidth.test.ts (+0 -5)
📝 packages/react/package.json (+4 -0)
📝 packages/react/scripts/build.ts (+19 -0)
📝 packages/react/src/reconciler/reconciler.ts (+2 -0)
📝 packages/react/src/reconciler/renderer.ts (+21 -18)
packages/react/src/test-utils.ts (+36 -0)
packages/react/tests/__snapshots__/layout.test.tsx.snap (+195 -0)
packages/react/tests/layout.test.tsx (+413 -0)

📄 Description

Add React Test Suite and Testing Utilities

Summary

Adds testing utils for the React package, including test utilities, layout tests, and workflow integration. The test suite covers basic rendering, layout components, error boundaries, and edge cases.

Changes

Features

  • Test Utilities (packages/react/src/test-utils.ts)
    • Added testRender() helper function for testing React components
    • Properly handles React's act() API for testing
    • Manages React Act Environment flag for test isolation

Enhancements

  • Enhanced createRoot API (packages/react/src/reconciler/renderer.ts)

    • Added unmount() method to Root type for proper cleanup
    • Improved container management for better test isolation
    • Removed deprecated render() function
  • Build Updates

    • Updated build script to include test-utils entry point
    • Added test-utils export to package.json exports map
    • Generated TypeScript declarations for test utilities
  • CI/CD Integration

    • Added test step to React build workflow
    • Updated root package.json to include React tests in test script

Breaking Changes

None - this is purely additive.

N/A


🔄 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/anomalyco/opentui/pull/309 **Author:** [@msmps](https://github.com/msmps) **Created:** 11/12/2025 **Status:** ✅ Merged **Merged:** 11/12/2025 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `feat/add-react-test-suite-20251112171051` --- ### 📝 Commits (7) - [`bbcb0f3`](https://github.com/anomalyco/opentui/commit/bbcb0f37149df390d24a28111ce6c9e976613790) Update React package with test-utils and layout tests - [`a51fa60`](https://github.com/anomalyco/opentui/commit/a51fa6099252737d9d225ad7e68f474c961d9042) chore: update workflow to run tests - [`7f825c6`](https://github.com/anomalyco/opentui/commit/7f825c6efd8c1535343e527a8b50568099b42c31) refactor: update import path for testRender in layout tests - [`a56ee22`](https://github.com/anomalyco/opentui/commit/a56ee22da549fb5781e70e122ede749985093194) chore: add zig setup step to build workflow - [`1708c56`](https://github.com/anomalyco/opentui/commit/1708c5652f7d5e6918c51e9a7f0e0064cc00aeeb) refactor: remove unnecessary blank lines in extmarks multiwidth tests - [`83fe2df`](https://github.com/anomalyco/opentui/commit/83fe2df8aaf73aef3249d1142ac3da5d8826ca38) chore: simplify build command in React workflow - [`d34410d`](https://github.com/anomalyco/opentui/commit/d34410d778c6e7d4fd3f72910f61f13267d440d9) chore: update React workflow job name to reflect testing ### 📊 Changes **10 files changed** (+703 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/build-react.yml` (+12 -2) 📝 `package.json` (+1 -1) 📝 `packages/core/src/lib/extmarks-multiwidth.test.ts` (+0 -5) 📝 `packages/react/package.json` (+4 -0) 📝 `packages/react/scripts/build.ts` (+19 -0) 📝 `packages/react/src/reconciler/reconciler.ts` (+2 -0) 📝 `packages/react/src/reconciler/renderer.ts` (+21 -18) ➕ `packages/react/src/test-utils.ts` (+36 -0) ➕ `packages/react/tests/__snapshots__/layout.test.tsx.snap` (+195 -0) ➕ `packages/react/tests/layout.test.tsx` (+413 -0) </details> ### 📄 Description # Add React Test Suite and Testing Utilities ## Summary Adds testing utils for the React package, including test utilities, layout tests, and workflow integration. The test suite covers basic rendering, layout components, error boundaries, and edge cases. ## Changes ### Features - **Test Utilities** (`packages/react/src/test-utils.ts`) - Added `testRender()` helper function for testing React components - Properly handles React's `act()` API for testing - Manages React Act Environment flag for test isolation ### Enhancements - **Enhanced `createRoot` API** (`packages/react/src/reconciler/renderer.ts`) - Added `unmount()` method to `Root` type for proper cleanup - Improved container management for better test isolation - Removed deprecated `render()` function - **Build Updates** - Updated build script to include test-utils entry point - Added test-utils export to package.json exports map - Generated TypeScript declarations for test utilities - **CI/CD Integration** - Added test step to React build workflow - Updated root package.json to include React tests in test script ## Breaking Changes None - this is purely additive. ## Related Issues N/A --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:25:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1223
No description provided.