Skip to content

[noop] Typecheck react-noop-renderer against host config and renderer API#35944

Merged
eps1lon merged 3 commits intofacebook:mainfrom
eps1lon:sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api
Mar 4, 2026
Merged

[noop] Typecheck react-noop-renderer against host config and renderer API#35944
eps1lon merged 3 commits intofacebook:mainfrom
eps1lon:sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 2, 2026

The react-noop-renderer was not actually typechecked against the host config and renderer API. This missed a bunch of bugs due to wrong argument or missing host config.

Not implementing certain host configs should be done explicitly (e.g. throwing) instead of just omission. This makes it clearer why certain tests can't be written against the noop renderer.

This PR only sets up typechecking by adding a new inlined host config for the react-noop-renderer package. No runtime behavior should be changed. In follow-ups, I'll adjust the runtime to fix the type issues.

With types, setting up test infra for new features is easier (e.g. writing ViewTransition tests against the noop renderer).

Test plan

@meta-cla meta-cla bot added the CLA Signed label Mar 2, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Mar 2, 2026
@react-sizebot
Copy link

react-sizebot commented Mar 2, 2026

Comparing: ee4699f...6c5daaf

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 611.79 kB 611.79 kB = 108.12 kB 108.12 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 677.72 kB 677.72 kB = 119.08 kB 119.08 kB
facebook-www/ReactDOM-prod.classic.js = 697.67 kB 697.67 kB = 122.58 kB 122.58 kB
facebook-www/ReactDOM-prod.modern.js = 687.98 kB 687.98 kB = 120.96 kB 120.96 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 6c5daaf

@eps1lon eps1lon force-pushed the sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api branch from 6af11f2 to 807c8de Compare March 2, 2026 19:18
Comment on lines +252 to +256
if (global.__PERSISTENT__) {
jest.mock('react-noop-renderer', () =>
jest.requireActual('react-noop-renderer/persistent')
);
}
Copy link
Collaborator Author

@eps1lon eps1lon Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupHostConfigs runs after setupTests.*. Now that we have an inlined host config for react-noop-renderer, we mock it's entrypoint which overrides the mock from setupTests.* i.e. imports to react-noop-renderer with --persistent no longer got the persistent renderer.

I moved the mocking from the setupTests.* file into this module to have mocking of the entrypoints affected by host configs in a single module which makes ordering conflicts more obvious.

@eps1lon eps1lon force-pushed the sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api branch from 8915922 to 6c5daaf Compare March 4, 2026 12:46
@eps1lon eps1lon merged commit 5e42791 into facebook:main Mar 4, 2026
235 of 236 checks passed
@eps1lon eps1lon deleted the sebbie/03-02-_noop_typecheck_react-noop-renderer_against_host_config_and_renderer_api branch March 4, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants