147
it('should throw with silly args', () => {
148
expect(
149
ReactDOMServer.renderToString.bind(ReactDOMServer, {x: 123}),
150
- ).toThrowError(
150
+ ).toThrow(
151
'Objects are not valid as a React child (found: object with keys {x})',
152
);
153
});
155
it('should throw prop mapping error for an <iframe /> with invalid props', () => {
156
expect(() => {
157
ReactDOMServer.renderToString(<iframe style="border:none;" />);
158
- }).toThrowError(
158
+ }).toThrow(
159
'The `style` prop expects a mapping from style properties to values, not ' +
160
"a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.",
161
);
290
it('should throw with silly args', () => {
291
expect(
292
ReactDOMServer.renderToStaticMarkup.bind(ReactDOMServer, {x: 123}),
293
- ).toThrowError(
293
+ ).toThrow(
294
'Objects are not valid as a React child (found: object with keys {x})',
295
);
296
});
715
<span key={2} />
716
</Wrapper>,
717
);
718
- }).toThrowError(/Cannot assign to read only property.*/);
718
+ }).toThrow(/Cannot assign to read only property.*/);
719
} else {
720
expect(
721
ReactDOMServer.renderToStaticMarkup(
966
967
expect(() => {
968
ReactDOMServer.renderToString(<Foo />);
969
- }).toThrow("Cannot read property 'world' of undefined");
969
+ }).toThrow("Cannot read properties of undefined (reading 'world')");
970
});
971
972
it('should warn when class contextType is undefined', () => {
981
982
expect(() => {
983
ReactDOMServer.renderToString(<Foo />);
984
- }).toThrow("Cannot read property 'world' of undefined");
984
+ }).toThrow("Cannot read properties of undefined (reading 'world')");
985
assertConsoleErrorDev([
986
'Foo defines an invalid contextType. ' +
987
'contextType should point to the Context object returned by React.createContext(). ' +
1007
1008
expect(() => {
1009
ReactDOMServer.renderToString(<Foo />);
1010
- }).toThrow("Cannot read property 'hello' of undefined");
1010
+ }).toThrow("Cannot read properties of undefined (reading 'hello')");
1011
assertConsoleErrorDev([
1012
'Foo defines an invalid contextType. ' +
1013
'contextType should point to the Context object returned by React.createContext(). ' +
1026
1027
expect(() => {
1028
ReactDOMServer.renderToString(<Foo />);
1029
- }).toThrow("Cannot read property 'world' of undefined");
1029
+ }).toThrow("Cannot read properties of undefined (reading 'world')");
1030
assertConsoleErrorDev([
1031
'Foo defines an invalid contextType. ' +
1032
'contextType should point to the Context object returned by React.createContext(). ' +