Skip to content
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

Remote .internal override from untrusted URL tests #26372

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ function runTests(itRenders, itRejectsRendering, expectToReject) {
}

describe('ReactDOMServerIntegration - Untrusted URLs', () => {
// The `itRenders` helpers don't work with the gate pragma, so we have to do
// this instead.
if (gate(flags => flags.disableJavaScriptURLs)) {
it("empty test so Jest doesn't complain", () => {});
return;
}

function initModules() {
jest.resetModules();
React = require('react');
Expand Down Expand Up @@ -181,6 +188,13 @@ describe('ReactDOMServerIntegration - Untrusted URLs', () => {
});

describe('ReactDOMServerIntegration - Untrusted URLs - disableJavaScriptURLs', () => {
// The `itRenders` helpers don't work with the gate pragma, so we have to do
// this instead.
if (gate(flags => !flags.disableJavaScriptURLs)) {
it("empty test so Jest doesn't complain", () => {});
return;
}

function initModules() {
jest.resetModules();
const ReactFeatureFlags = require('shared/ReactFeatureFlags');
Expand Down
11 changes: 1 addition & 10 deletions scripts/jest/setupTests.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ jest.mock('shared/ReactFeatureFlags', () => {
() => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'),
{virtual: true}
);

const wwwFlags = jest.requireActual('shared/forks/ReactFeatureFlags.www');
const defaultFlags = jest.requireActual('shared/ReactFeatureFlags');

// TODO: Many tests were written before we started running them against the
// www configuration. Update those tests so that they work against the www
// configuration, too. Then remove these overrides.
wwwFlags.disableJavaScriptURLs = defaultFlags.disableJavaScriptURLs;

return wwwFlags;
return jest.requireActual('shared/forks/ReactFeatureFlags.www');
});

jest.mock('scheduler/src/SchedulerFeatureFlags', () => {
Expand Down