Skip to content

Conversation

@bosun-ai
Copy link

@bosun-ai bosun-ai bot commented Nov 25, 2025

Summary

Upgrade React from ^16.8.4 to 17.0.2 and add a basic regression test suite to validate compatibility. This PR is a work in progress and should not be merged.

Scope of changes

  • Package updates to support React 17 migration and testing:
    • Added @testing-library/react (10.x) and @testing-library/jest-dom to devDependencies
    • Added msw (0.27.0) and cross-fetch (3.x) for network-mocking and fetch polyfill
    • Introduced test:regression npm script
  • Regression test suite scaffolding under regression-tests/ with Jest + jsdom configuration and a minimal smoke test
  • Tooling/runtime setup files: .nvmrc for Node 12 and .yarnrc.yml to use node-modules linker

Regression test suite setup

Regression test suite added and verified passing. Installed compatible testing-library, msw, and cross-fetch versions; configured Jest + jsdom with setup shims; added a non-JSX React smoke test. Run via yarn run test:regression. Documented installed versions and next steps.

Installed versions and configuration

  • Node runtime: .nvmrc set to 12
  • Yarn configuration: .yarnrc.yml with nodeLinker: node-modules
  • Jest config: regression-tests/jest.config.js
    • testEnvironment: jest-environment-jsdom
    • setupTestFrameworkScriptFile: regression-tests/setupTests.js
    • testMatch: **/*.test.js
    • testURL: http://localhost/
  • Testing libraries:
    • @testing-library/react: 10.x
    • @testing-library/jest-dom: 4.2.4 (declared) / README references 5.17.0 for extend-expect compatibility
    • msw: 0.27.0
    • cross-fetch: 3.x
  • Regression tests:
    • regression-tests/example.test.js: non-JSX React.createElement smoke test using testing-library
    • regression-tests/setupTests.js: jest-dom matchers, jsdom shims (location, localStorage), and msw server lifecycle hooks
    • regression-tests/server.js and handlers.js: MSW server setup with placeholder handlers
    • regression-tests/README.md: run instructions and environment notes

Testing instructions

  • Ensure Node and Yarn versions are aligned:
    • nvm use
    • node -v should output a Node 12.x version
    • yarn -v should output 1.22.x
  • Install dependencies:
    • yarn install (use --ignore-engines if transient engine checks block install under Node 12)
  • Run the regression suite:
    • yarn run test:regression

Rationale

  • Introducing a focused regression suite helps validate React 17 upgrade effects in isolation while we adapt the broader test infrastructure.
  • Using @testing-library/react 10.x maintains compatibility with older project tooling while providing basic render/assert utilities under jsdom.
  • MSW and cross-fetch enable controlled network behavior and consistent fetch usage across environments.

Impact and risk

  • Minimal runtime impact; changes are confined to devDependencies, test configuration, and regression test files.
  • Potential for transient dependency resolution differences due to Node 12 engine constraints; documented workaround via --ignore-engines.

Follow-ups and open questions

  • Align @testing-library/jest-dom versioning across README and package.json; confirm target version for React 17 baseline.
  • Evaluate upgrading @testing-library/react to a version aligned with React 17 once broader tooling is updated.
  • Expand MSW handlers to cover key API interactions used by upgraded components.
  • Integrate regression tests into CI (using test:regression) and determine whether they should run alongside existing test:ci.
  • Review any deprecations/warnings emitted by React 17 in the current app codebase and add targeted tests.

Reviewer checklist

  • Verify devDependency versions match intended compatibility for React 17
  • Run yarn run test:regression locally and confirm passing
  • Confirm Node/Yarn versions per .nvmrc and README
  • Validate that jsdom shims do not mask issues that should be addressed in application code

Related documentation

  • regression-tests/README.md: environment and run instructions

Note

This is a draft pull request intended for review only.


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 WIP for React upgrade to 17.0.2 chore: upgrade React to 17.0.2 and add regression test suite scaffolding (WIP) Nov 25, 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.

1 participant