Skip to content

[Tests][Fizz] Test script runtime even when external runtime is available #28794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe('ReactDOMFizzServer', () => {
});

renderOptions = {};
if (gate(flags => flags.enableFizzExternalRuntime)) {
if (gate(flags => flags.shouldUseFizzExternalRuntime)) {
renderOptions.unstable_externalRuntimeSrc =
'react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js';
}
Expand Down Expand Up @@ -610,7 +610,7 @@ describe('ReactDOMFizzServer', () => {
Array.from(container.getElementsByTagName('script')).filter(
node => node.getAttribute('nonce') === CSPnonce,
).length,
).toEqual(6);
).toEqual(gate(flags => flags.shouldUseFizzExternalRuntime) ? 6 : 5);

await act(() => {
resolve({default: Text});
Expand Down Expand Up @@ -4292,7 +4292,7 @@ describe('ReactDOMFizzServer', () => {
);
});

// @gate enableFizzExternalRuntime
// @gate shouldUseFizzExternalRuntime
it('does not send script tags for SSR instructions when using the external runtime', async () => {
function App() {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/ReactDOMFloat-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('ReactDOMFloat', () => {
});

renderOptions = {};
if (gate(flags => flags.enableFizzExternalRuntime)) {
if (gate(flags => flags.shouldUseFizzExternalRuntime)) {
renderOptions.unstable_externalRuntimeSrc =
'react-dom/unstable_server-external-runtime';
}
Expand Down
9 changes: 9 additions & 0 deletions scripts/jest/TestFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ function getTestFlags() {
enableSuspenseList: releaseChannel === 'experimental' || www,
enableLegacyHidden: www,

// This flag is used to determine whether we should run Fizz tests using
// the external runtime or the inline script runtime.
// For Meta we use variant to gate the feature. For OSS we use experimental
shouldUseFizzExternalRuntime: !featureFlags.enableFizzExternalRuntime
? false
: www
? __VARIANT__
: __EXPERIMENTAL__,

// This is used by useSyncExternalStoresShared-test.js to decide whether
// to test the shim or the native implementation of useSES.
// TODO: It's disabled when enableRefAsProp is on because the JSX
Expand Down