Skip to content
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
16 changes: 8 additions & 8 deletions packages/react-dom/src/__tests__/ReactServerRendering-test.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -147,15 +147,15 @@ describe('ReactDOMServer', () => {
it('should throw with silly args', () => {
expect(
ReactDOMServer.renderToString.bind(ReactDOMServer, {x: 123}),
).toThrowError(
).toThrow(
'Objects are not valid as a React child (found: object with keys {x})',
);
});

it('should throw prop mapping error for an <iframe /> with invalid props', () => {
expect(() => {
ReactDOMServer.renderToString(<iframe style="border:none;" />);
}).toThrowError(
}).toThrow(
'The `style` prop expects a mapping from style properties to values, not ' +
"a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.",
);
Expand DownExpand Up@@ -290,7 +290,7 @@ describe('ReactDOMServer', () => {
it('should throw with silly args', () => {
expect(
ReactDOMServer.renderToStaticMarkup.bind(ReactDOMServer, {x: 123}),
).toThrowError(
).toThrow(
'Objects are not valid as a React child (found: object with keys {x})',
);
});
Expand DownExpand Up@@ -715,7 +715,7 @@ describe('ReactDOMServer', () => {
<span key={2} />
</Wrapper>,
);
}).toThrowError(/Cannot assign to read only property.*/);
}).toThrow(/Cannot assign to read only property.*/);
} else {
expect(
ReactDOMServer.renderToStaticMarkup(
Expand DownExpand Up@@ -966,7 +966,7 @@ describe('ReactDOMServer', () => {

expect(() => {
ReactDOMServer.renderToString(<Foo />);
}).toThrow("Cannot read property 'world' of undefined");
}).toThrow("Cannot read properties of undefined (reading 'world')");
});

it('should warn when class contextType is undefined', () => {
Expand All@@ -981,7 +981,7 @@ describe('ReactDOMServer', () => {

expect(() => {
ReactDOMServer.renderToString(<Foo />);
}).toThrow("Cannot read property 'world' of undefined");
}).toThrow("Cannot read properties of undefined (reading 'world')");
assertConsoleErrorDev([
'Foo defines an invalid contextType. ' +
'contextType should point to the Context object returned by React.createContext(). ' +
Expand All@@ -1007,7 +1007,7 @@ describe('ReactDOMServer', () => {

expect(() => {
ReactDOMServer.renderToString(<Foo />);
}).toThrow("Cannot read property 'hello' of undefined");
}).toThrow("Cannot read properties of undefined (reading 'hello')");
assertConsoleErrorDev([
'Foo defines an invalid contextType. ' +
'contextType should point to the Context object returned by React.createContext(). ' +
Expand All@@ -1026,7 +1026,7 @@ describe('ReactDOMServer', () => {

expect(() => {
ReactDOMServer.renderToString(<Foo />);
}).toThrow("Cannot read property 'world' of undefined");
}).toThrow("Cannot read properties of undefined (reading 'world')");
assertConsoleErrorDev([
'Foo defines an invalid contextType. ' +
'contextType should point to the Context object returned by React.createContext(). ' +
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -234,7 +234,7 @@ describe('ReactHooksWithNoopRenderer', () => {

it('throws when called outside the render phase', async () => {
expect(() => useState(0)).toThrow(
"Cannot read property 'useState' of null",
"Cannot read properties of null (reading 'useState')",
);
assertConsoleErrorDev([
'Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' +
Expand Down
50 changes: 0 additions & 50 deletions scripts/jest/matchers/toThrow.js

This file was deleted.

1 change: 0 additions & 1 deletion scripts/jest/setupTests.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,7 +47,6 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {

expect.extend({
...require('./matchers/reactTestMatchers'),
...require('./matchers/toThrow'),
});

// We have a Babel transform that inserts guards against infinite loops.
Expand Down
1 change: 0 additions & 1 deletion scripts/jest/spec-equivalence-reporter/setupTests.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,5 +60,4 @@ afterEach(assertConsoleLogsCleared);

expect.extend({
...require('../matchers/reactTestMatchers'),
...require('../matchers/toThrow'),
});
Loading