Skip to content

Commit 66ee575

Browse files
authored
Rename toWarnDev -> toErrorDev, toLowPriorityWarnDev -> toWarnDev (#17605)
* Rename toWarnDev -> toErrorDev in tests * Rename toWarnDev matcher implementation to toErrorDev * Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation
1 parent 9254e4a commit 66ee575

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/__tests__/ReactShallowRenderer-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ describe('ReactShallowRenderer', () => {
11951195
}
11961196

11971197
const shallowRenderer = createRenderer();
1198-
expect(() => shallowRenderer.render(<SimpleComponent />)).toWarnDev(
1198+
expect(() => shallowRenderer.render(<SimpleComponent />)).toErrorDev(
11991199
'Warning: Failed context type: The context `name` is marked as ' +
12001200
'required in `SimpleComponent`, but its value is `undefined`.\n' +
12011201
' in SimpleComponent (at **)',
@@ -1216,7 +1216,7 @@ describe('ReactShallowRenderer', () => {
12161216
const shallowRenderer = createRenderer();
12171217
expect(() =>
12181218
shallowRenderer.render(React.createElement(SimpleComponent, {name: 123})),
1219-
).toWarnDev(
1219+
).toErrorDev(
12201220
'Warning: Failed prop type: Invalid prop `name` of type `number` ' +
12211221
'supplied to `SimpleComponent`, expected `string`.\n' +
12221222
' in SimpleComponent',
@@ -1344,7 +1344,7 @@ describe('ReactShallowRenderer', () => {
13441344

13451345
const renderAndVerifyWarningAndError = (Component, typeString) => {
13461346
expect(() => {
1347-
expect(() => shallowRenderer.render(<Component />)).toWarnDev(
1347+
expect(() => shallowRenderer.render(<Component />)).toErrorDev(
13481348
'React.createElement: type is invalid -- expected a string ' +
13491349
'(for built-in components) or a class/function (for composite components) ' +
13501350
`but got: ${typeString}.`,
@@ -1555,7 +1555,7 @@ describe('ReactShallowRenderer', () => {
15551555
expect(() => {
15561556
const SomeComponent = React.forwardRef(SomeMemoComponent);
15571557
shallowRenderer.render(<SomeComponent ref={testRef} />);
1558-
}).toWarnDev(
1558+
}).toErrorDev(
15591559
'Warning: forwardRef requires a render function but received ' +
15601560
'a `memo` component. Instead of forwardRef(memo(...)), use ' +
15611561
'memo(forwardRef(...))',

src/__tests__/ReactShallowRendererMemo-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ describe('ReactShallowRendererMemo', () => {
12421242
);
12431243

12441244
const shallowRenderer = createRenderer();
1245-
expect(() => shallowRenderer.render(<SimpleComponent />)).toWarnDev(
1245+
expect(() => shallowRenderer.render(<SimpleComponent />)).toErrorDev(
12461246
'Warning: Failed context type: The context `name` is marked as ' +
12471247
'required in `SimpleComponent`, but its value is `undefined`.\n' +
12481248
' in SimpleComponent (at **)',
@@ -1265,7 +1265,7 @@ describe('ReactShallowRendererMemo', () => {
12651265
const shallowRenderer = createRenderer();
12661266
expect(() =>
12671267
shallowRenderer.render(React.createElement(SimpleComponent, {name: 123})),
1268-
).toWarnDev(
1268+
).toErrorDev(
12691269
'Warning: Failed prop type: Invalid prop `name` of type `number` ' +
12701270
'supplied to `SimpleComponent`, expected `string`.\n' +
12711271
' in SimpleComponent',
@@ -1401,7 +1401,7 @@ describe('ReactShallowRendererMemo', () => {
14011401

14021402
const renderAndVerifyWarningAndError = (Component, typeString) => {
14031403
expect(() => {
1404-
expect(() => shallowRenderer.render(<Component />)).toWarnDev(
1404+
expect(() => shallowRenderer.render(<Component />)).toErrorDev(
14051405
'React.createElement: type is invalid -- expected a string ' +
14061406
'(for built-in components) or a class/function (for composite components) ' +
14071407
`but got: ${typeString}.`,

src/__tests__/ReactTestRenderer-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ describe('ReactTestRenderer', () => {
281281
}
282282
}
283283
ReactTestRenderer.create(<Baz />);
284-
expect(() => ReactTestRenderer.create(<Foo />)).toWarnDev(
284+
expect(() => ReactTestRenderer.create(<Foo />)).toErrorDev(
285285
'Warning: Function components cannot be given refs. Attempts ' +
286286
'to access this ref will fail. ' +
287287
'Did you mean to use React.forwardRef()?\n\n' +

src/__tests__/ReactTestRenderer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('ReactTestRenderer', () => {
3434
expect(() => {
3535
ReactTestRenderer.create(ReactDOM.createPortal('foo', container));
3636
}).toThrow();
37-
}).toWarnDev('An invalid container has been provided.', {
37+
}).toErrorDev('An invalid container has been provided.', {
3838
withoutStack: true,
3939
});
4040
});

src/__tests__/ReactTestRendererAct-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('ReactTestRenderer.act()', () => {
5050

5151
expect(() => {
5252
setCtr(1);
53-
}).toWarnDev([
53+
}).toErrorDev([
5454
'An update to App inside a test was not wrapped in act(...)',
5555
]);
5656
});

0 commit comments

Comments
 (0)