Skip to content

Conversation

@bosun-ai
Copy link

@bosun-ai bosun-ai bot commented Dec 9, 2025

Summary

Prepare upgrade path for React 17 by introducing a basic regression test suite scaffold and associated tooling. This PR is a work in progress and serves as a placeholder for the React 16.8.6 → 17.0.2 upgrade effort.

Changes

  • Added regression test suite scaffolding under regression-tests/:
    • jest.config.js with jsdom environment and setup file
    • setupTests.js configuring @testing-library, MSW server lifecycle, and a fetch polyfill
    • server.js and handlers.js for MSW request mocking
    • simple-component.test.js example rendering and click interaction test
  • Introduced test dependencies:
    • @testing-library/react@12.1.5
    • @testing-library/jest-dom@4.2.4
    • msw@0.25.0
    • cross-fetch@^4.1.0 (Node fetch polyfill for tests)
  • Added test:regression script to package.json invoking Jest with the regression config
  • Added .nvmrc specifying Node 12 for consistent local/test environment

Reasoning

  • Establish a minimal regression test framework to validate UI behavior during React version upgrades.
  • Use MSW to isolate tests from real network calls and ensure deterministic behavior.
  • Provide a consistent Node version via .nvmrc to reduce environment-related test variance.

Regression test suite setup

  • Test framework
    • Jest with jsdom test environment configured via regression-tests/jest.config.js
    • @testing-library utilities for DOM queries and events
    • MSW for request mocking, with lifecycle managed in setupTests.js
    • Cross-fetch polyfill for Node environment
  • File locations
    • Config: regression-tests/jest.config.js
    • Setup: regression-tests/setupTests.js
    • MSW server: regression-tests/server.js
    • Handlers: regression-tests/handlers.js
    • Example test: regression-tests/simple-component.test.js

Testing instructions

  • Run regression tests:
    nvm use && yarn run test:regression
    
  • Example single-component test run:
    nvm use && yarn run test:regression
    
    Note: Jest will discover tests matching **/*.test.js under regression-tests/.

Impact and risk

  • Low risk: changes are test-only scaffolding and do not modify application runtime code.
  • Ensures a baseline test suite exists before proceeding with React upgrade changes.

Follow-ups / open questions

  • Expand test coverage to include key components and interaction patterns affected by React 17 changes (event system, rendering, portals).
  • Confirm Node version alignment with CI and production; adjust .nvmrc as needed.
  • Integrate regression tests into CI (e.g., a dedicated job).
  • Define MSW handlers for endpoints used by components under test.

Reviewer checklist

  • Validate that yarn run test:regression executes successfully locally with nvm use.
  • Confirm the chosen dependency versions are compatible with React 16.8.6 and 17.0.2 during the upgrade.
  • Suggest additional components or flows to prioritize for regression coverage.

Links

  • This is a test PR for the React upgrade effort; do not merge.

This pull request is created by bosun, a code maintenance automation platform. For more information, visit bosun.ai.

@bosun-ai bosun-ai bot changed the title chore: prepare React upgrade to 17.0.2 (WIP) test: scaffold regression test suite for React 17 upgrade (WIP) Dec 9, 2025
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.

0 participants