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

Update error messages #28652

Merged
merged 1 commit into from
Mar 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,7 @@ describe('InspectedElement', () => {
const container = document.createElement('div');
container.innerHTML = '<div></div>';
withErrorsOrWarningsIgnored(
['ReactDOM.hydrate is no longer supported in React 18'],
['ReactDOM.hydrate has not been supported since React 18'],
() => {
ReactDOM.hydrate(<Example />, container);
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shared/src/__tests__/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function getLegacyRenderImplementation(): RenderImplementation {

function render(elements) {
withErrorsOrWarningsIgnored(
['ReactDOM.render is no longer supported in React 18'],
['ReactDOM.render has not been supported since React 18'],
() => {
ReactDOM.render(elements, container);
},
Expand Down Expand Up @@ -340,7 +340,7 @@ export function legacyRender(elements, container) {

const ReactDOM = require('react-dom');
withErrorsOrWarningsIgnored(
['ReactDOM.render is no longer supported in React 18'],
['ReactDOM.render has not been supported since React 18'],
() => {
ReactDOM.render(elements, container);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-shell/src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ignoreErrors([
'Warning: Legacy context API',
'Warning: Unsafe lifecycle methods',
'Warning: %s is deprecated in StrictMode.', // findDOMNode
'Warning: ReactDOM.render is no longer supported in React 18',
'Warning: ReactDOM.render was removed in React 19',
]);
ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']);
ignoreLogs([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
],
]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Reported because we're in a browser click event:
expect.objectContaining({
Expand Down Expand Up @@ -136,7 +140,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}

Expand All @@ -157,7 +165,11 @@ describe('ReactDOMConsoleErrorReporting', () => {

if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -196,7 +208,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand All @@ -221,7 +237,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
if (__DEV__) {
expect(windowOnError.mock.calls).toEqual([]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -260,7 +280,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand All @@ -283,7 +307,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
if (__DEV__) {
expect(windowOnError.mock.calls).toEqual([]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -322,7 +350,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand Down Expand Up @@ -350,7 +382,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
if (__DEV__) {
expect(windowOnError.mock.calls).toEqual([]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -389,7 +425,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand All @@ -413,7 +453,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
if (__DEV__) {
expect(windowOnError.mock.calls).toEqual([]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -452,7 +496,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand Down Expand Up @@ -480,7 +528,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
if (__DEV__) {
expect(windowOnError.mock.calls).toEqual([]);
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
[
// Formatting
expect.stringContaining('%o'),
Expand Down Expand Up @@ -519,7 +571,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
expect(windowOnError.mock.calls).toEqual([]);
if (__DEV__) {
expect(console.error.mock.calls).toEqual([
[expect.stringContaining('ReactDOM.render is no longer supported')],
[
expect.stringContaining(
'ReactDOM.render has not been supported since React 18',
),
],
]);
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1193,10 +1193,10 @@ describe('ReactDOMLegacyFiber', () => {
if (__DEV__) {
expect(console.error).toHaveBeenCalledTimes(2);
expect(console.error.mock.calls[0][0]).toMatch(
'ReactDOM.render is no longer supported in React 18',
'ReactDOM.render has not been supported since React 18',
);
expect(console.error.mock.calls[1][0]).toMatch(
'ReactDOM.render is no longer supported in React 18',
'ReactDOM.render has not been supported since React 18',
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ describe('ReactErrorBoundaries', () => {
...gate(flags =>
flags.disableLegacyContext
? [
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
]
: [],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ describe('ReactLegacyContextDisabled', () => {
);
});
}).toErrorDev([
'LegacyProvider uses the legacy childContextTypes API which is no longer supported. ' +
'LegacyProvider uses the legacy childContextTypes API which was removed in React 19. ' +
'Use React.createContext() instead.',
'LegacyClsConsumer uses the legacy contextTypes API which is no longer supported. ' +
'LegacyClsConsumer uses the legacy contextTypes API which was removed in React 19. ' +
'Use React.createContext() with static contextType instead.',
'LegacyFnConsumer uses the legacy contextTypes API which is no longer supported. ' +
'LegacyFnConsumer uses the legacy contextTypes API which was removed in React 19. ' +
'Use React.createContext() with React.useContext() instead.',
]);
expect(container.textContent).toBe('{}undefinedundefined');
Expand Down Expand Up @@ -137,11 +137,11 @@ describe('ReactLegacyContextDisabled', () => {
container,
);
}).toErrorDev([
'LegacyProvider uses the legacy childContextTypes API which is no longer supported. ' +
'LegacyProvider uses the legacy childContextTypes API which was removed in React 19. ' +
'Use React.createContext() instead.',
'LegacyClsConsumer uses the legacy contextTypes API which is no longer supported. ' +
'LegacyClsConsumer uses the legacy contextTypes API which was removed in React 19. ' +
'Use React.createContext() with static contextType instead.',
'LegacyFnConsumer uses the legacy contextTypes API which is no longer supported. ' +
'LegacyFnConsumer uses the legacy contextTypes API which was removed in React 19. ' +
'Use React.createContext() with React.useContext() instead.',
]);
expect(text).toBe('<span>{}<!-- -->undefined<!-- -->undefined</span>');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ describe('ReactLegacyErrorBoundaries', () => {
if (__DEV__) {
expect(console.error).toHaveBeenCalledTimes(2);
expect(console.error.mock.calls[0][0]).toContain(
'ReactDOM.render is no longer supported',
'ReactDOM.render has not been supported since React 18',
);
expect(console.error.mock.calls[1][2]).toContain(
'The above error occurred in the <BrokenRender> component:',
Expand Down Expand Up @@ -869,8 +869,8 @@ describe('ReactLegacyErrorBoundaries', () => {
...gate(flags =>
flags.disableLegacyContext
? [
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
]
: [],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('ReactDOMRoot', () => {
if (__DEV__) {
expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error.mock.calls[0][0]).toContain(
'ReactDOM.render is no longer supported',
'ReactDOM.render has not been supported since React 18',
);
}
});
Expand All @@ -37,7 +37,7 @@ describe('ReactDOMRoot', () => {
if (__DEV__) {
expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error.mock.calls[0][0]).toContain(
'ReactDOM.hydrate is no longer supported',
'ReactDOM.hydrate has not been supported since React 18',
);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('renderSubtreeIntoContainer', () => {
renderSubtreeIntoContainer(this, <Component />, portal);
}.bind(this),
).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down Expand Up @@ -107,15 +107,15 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <Component />, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}

componentDidUpdate() {
expect(() => {
renderSubtreeIntoContainer(this, <Component />, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down Expand Up @@ -172,15 +172,15 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <Component />, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}

componentDidUpdate() {
expect(() => {
renderSubtreeIntoContainer(this, <Component />, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <div>hello</div>, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <Child />, portal);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down Expand Up @@ -290,7 +290,7 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <Middle />, portal1);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
static childContextTypes = {
Expand All @@ -306,7 +306,7 @@ describe('renderSubtreeIntoContainer', () => {
expect(() => {
renderSubtreeIntoContainer(this, <Child />, portal2);
}).toErrorDev(
'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
);
}
}
Expand Down
Loading