@samitouri / QOS-React / commits / 0b5a26a489

Rename toWarnDev -> toErrorDev, toLowPriorityWarnDev -> toWarnDev (#17605)

* Rename toWarnDev -> toErrorDev in tests * Rename toWarnDev matcher implementation to toErrorDev * Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation

Dan Abramov committed Dec 16, 2019 at 12:48 UTC 0b5a26a4895261894f04e50d5a700e83b9c0dcf6
97 files changed +766 -776
packages/create-subscription/src/__tests__/createSubscription-test.internal.js
+2 -2
@@ -452,7 +452,7 @@ describe('createSubscription', () => {
452 },
453 () => null,
454 );
455 - }).toWarnDev('Subscription must specify a getCurrentValue function', {
455 + }).toErrorDev('Subscription must specify a getCurrentValue function', {
456 withoutStack: true,
457 });
458 });
@@ -465,7 +465,7 @@ describe('createSubscription', () => {
465 },
466 () => null,
467 );
468 - }).toWarnDev('Subscription must specify a subscribe function', {
468 + }).toErrorDev('Subscription must specify a subscribe function', {
469 withoutStack: true,
470 });
471 });
packages/react-art/src/__tests__/ReactART-test.js
+3 -3
@@ -420,7 +420,7 @@ describe('ReactARTComponents', () => {
420 ReactTestRenderer.create(
421 <Circle stroke="green" strokeWidth={3} fill="blue" />,
422 ),
423 - ).toWarnDev(
423 + ).toErrorDev(
424 'Warning: Failed prop type: The prop `radius` is marked as required in `Circle`, ' +
425 'but its value is `undefined`.' +
426 '\n in Circle (at **)',
@@ -437,7 +437,7 @@ describe('ReactARTComponents', () => {
437 it('should warn if width/height is missing on a Rectangle component', () => {
438 expect(() =>
439 ReactTestRenderer.create(<Rectangle stroke="green" fill="blue" />),
440 - ).toWarnDev([
440 + ).toErrorDev([
441 'Warning: Failed prop type: The prop `width` is marked as required in `Rectangle`, ' +
442 'but its value is `undefined`.' +
443 '\n in Rectangle (at **)',
@@ -462,7 +462,7 @@ describe('ReactARTComponents', () => {
462 });
463
464 it('should warn if outerRadius/startAngle/endAngle is missing on a Wedge component', () => {
465 - expect(() => ReactTestRenderer.create(<Wedge fill="blue" />)).toWarnDev([
465 + expect(() => ReactTestRenderer.create(<Wedge fill="blue" />)).toErrorDev([
466 'Warning: Failed prop type: The prop `outerRadius` is marked as required in `Wedge`, ' +
467 'but its value is `undefined`.' +
468 '\n in Wedge (at **)',
packages/react-cache/src/__tests__/ReactCache-test.internal.js
+1 -1
@@ -172,7 +172,7 @@ describe('ReactCache', () => {
172 if (__DEV__) {
173 expect(() => {
174 expect(Scheduler).toFlushAndYield(['App', 'Loading...']);
175 - }).toWarnDev([
175 + }).toErrorDev([
176 'Invalid key type. Expected a string, number, symbol, or ' +
177 'boolean, but instead received: Hi,100\n\n' +
178 'To use non-primitive values as keys, you must pass a hash ' +
packages/react-dom/src/__tests__/CSSPropertyOperations-test.js
+6 -6
@@ -98,7 +98,7 @@ describe('CSSPropertyOperations', () => {
98
99 const root = document.createElement('div');
100
101 - expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
101 + expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
102 'Warning: Unsupported style property background-color. Did you mean backgroundColor?' +
103 '\n in div (at **)' +
104 '\n in Comp (at **)',
@@ -121,7 +121,7 @@ describe('CSSPropertyOperations', () => {
121 const root = document.createElement('div');
122 ReactDOM.render(<Comp />, root);
123
124 - expect(() => ReactDOM.render(<Comp style={styles} />, root)).toWarnDev([
124 + expect(() => ReactDOM.render(<Comp style={styles} />, root)).toErrorDev([
125 'Warning: Unsupported style property -ms-transform. Did you mean msTransform?' +
126 '\n in div (at **)' +
127 '\n in Comp (at **)',
@@ -150,7 +150,7 @@ describe('CSSPropertyOperations', () => {
150
151 const root = document.createElement('div');
152
153 - expect(() => ReactDOM.render(<Comp />, root)).toWarnDev([
153 + expect(() => ReactDOM.render(<Comp />, root)).toErrorDev([
154 // msTransform is correct already and shouldn't warn
155 'Warning: Unsupported vendor-prefixed style property oTransform. ' +
156 'Did you mean OTransform?' +
@@ -183,7 +183,7 @@ describe('CSSPropertyOperations', () => {
183
184 const root = document.createElement('div');
185
186 - expect(() => ReactDOM.render(<Comp />, root)).toWarnDev([
186 + expect(() => ReactDOM.render(<Comp />, root)).toErrorDev([
187 "Warning: Style property values shouldn't contain a semicolon. " +
188 'Try "backgroundColor: blue" instead.' +
189 '\n in div (at **)' +
@@ -206,7 +206,7 @@ describe('CSSPropertyOperations', () => {
206
207 const root = document.createElement('div');
208
209 - expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
209 + expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
210 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
211 '\n in div (at **)' +
212 '\n in Comp (at **)',
@@ -235,7 +235,7 @@ describe('CSSPropertyOperations', () => {
235
236 const root = document.createElement('div');
237
238 - expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
238 + expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
239 'Warning: `Infinity` is an invalid value for the `fontSize` css style property.' +
240 '\n in div (at **)' +
241 '\n in Comp (at **)',
packages/react-dom/src/__tests__/DOMPropertyOperations-test.js
+1 -1
@@ -183,7 +183,7 @@ describe('DOMPropertyOperations', () => {
183 <input type="text" onChange={function() {}} />,
184 container,
185 ),
186 - ).toWarnDev(
186 + ).toErrorDev(
187 'A component is changing a controlled input of type text to be uncontrolled',
188 );
189 if (disableInputAttributeSyncing) {
packages/react-dom/src/__tests__/EventPluginHub-test.js
+1 -1
@@ -27,7 +27,7 @@ describe('EventPluginHub', () => {
27 node = ReactTestUtils.renderIntoDocument(
28 <div onClick="not a function" />,
29 );
30 - }).toWarnDev(
30 + }).toErrorDev(
31 'Expected `onClick` listener to be a function, instead got a value of `string` type.',
32 );
33 expect(() => ReactTestUtils.SimulateNative.click(node)).toThrowError(
packages/react-dom/src/__tests__/ReactChildReconciler-test.js
+5 -5
@@ -65,7 +65,7 @@ describe('ReactChildReconciler', () => {
65 <h1>{iterableFunction}</h1>
66 </div>,
67 );
68 - }).toWarnDev('Functions are not valid as a React child');
68 + }).toErrorDev('Functions are not valid as a React child');
69
70 expect(node.innerHTML).toContain(''); // h1
71 });
@@ -77,7 +77,7 @@ describe('ReactChildReconciler', () => {
77 }
78 }
79
80 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
80 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
81 'Keys should be unique so that components maintain their identity ' +
82 'across updates. Non-unique keys may cause children to be ' +
83 'duplicated and/or omitted — the behavior is unsupported and ' +
@@ -104,7 +104,7 @@ describe('ReactChildReconciler', () => {
104 }
105 }
106
107 - expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toWarnDev(
107 + expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toErrorDev(
108 'Encountered two children with the same key, `1`. ' +
109 'Keys should be unique so that components maintain their identity ' +
110 'across updates. Non-unique keys may cause children to be ' +
@@ -124,7 +124,7 @@ describe('ReactChildReconciler', () => {
124 }
125 }
126
127 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
127 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
128 'Keys should be unique so that components maintain their identity ' +
129 'across updates. Non-unique keys may cause children to be ' +
130 'duplicated and/or omitted — the behavior is unsupported and ' +
@@ -151,7 +151,7 @@ describe('ReactChildReconciler', () => {
151 }
152 }
153
154 - expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toWarnDev(
154 + expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toErrorDev(
155 'Encountered two children with the same key, `1`. ' +
156 'Keys should be unique so that components maintain their identity ' +
157 'across updates. Non-unique keys may cause children to be ' +
packages/react-dom/src/__tests__/ReactComponent-test.js
+7 -7
@@ -397,7 +397,7 @@ describe('ReactComponent', () => {
397 it('throws usefully when rendering badly-typed elements', () => {
398 const X = undefined;
399 expect(() => {
400 - expect(() => ReactTestUtils.renderIntoDocument(<X />)).toWarnDev(
400 + expect(() => ReactTestUtils.renderIntoDocument(<X />)).toErrorDev(
401 'React.createElement: type is invalid -- expected a string (for built-in components) ' +
402 'or a class/function (for composite components) but got: undefined.',
403 );
@@ -412,7 +412,7 @@ describe('ReactComponent', () => {
412
413 const Y = null;
414 expect(() => {
415 - expect(() => ReactTestUtils.renderIntoDocument(<Y />)).toWarnDev(
415 + expect(() => ReactTestUtils.renderIntoDocument(<Y />)).toErrorDev(
416 'React.createElement: type is invalid -- expected a string (for built-in components) ' +
417 'or a class/function (for composite components) but got: null.',
418 );
@@ -442,7 +442,7 @@ describe('ReactComponent', () => {
442 }
443
444 expect(() => {
445 - expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toWarnDev(
445 + expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toErrorDev(
446 'React.createElement: type is invalid -- expected a string (for built-in components) ' +
447 'or a class/function (for composite components) but got: undefined.',
448 );
@@ -572,7 +572,7 @@ describe('ReactComponent', () => {
572 return Foo;
573 }
574 const container = document.createElement('div');
575 - expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
575 + expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
576 'Warning: Functions are not valid as a React child. This may happen if ' +
577 'you return a Component instead of <Component /> from render. ' +
578 'Or maybe you meant to call this function rather than return it.\n' +
@@ -587,7 +587,7 @@ describe('ReactComponent', () => {
587 }
588 }
589 const container = document.createElement('div');
590 - expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
590 + expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
591 'Warning: Functions are not valid as a React child. This may happen if ' +
592 'you return a Component instead of <Component /> from render. ' +
593 'Or maybe you meant to call this function rather than return it.\n' +
@@ -604,7 +604,7 @@ describe('ReactComponent', () => {
604 );
605 }
606 const container = document.createElement('div');
607 - expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
607 + expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
608 'Warning: Functions are not valid as a React child. This may happen if ' +
609 'you return a Component instead of <Component /> from render. ' +
610 'Or maybe you meant to call this function rather than return it.\n' +
@@ -649,7 +649,7 @@ describe('ReactComponent', () => {
649 let component;
650 expect(() => {
651 component = ReactDOM.render(<Foo />, container);
652 - }).toWarnDev([
652 + }).toErrorDev([
653 'Warning: Functions are not valid as a React child. This may happen if ' +
654 'you return a Component instead of <Component /> from render. ' +
655 'Or maybe you meant to call this function rather than return it.\n' +
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
+34 -36
@@ -211,7 +211,7 @@ describe('ReactComponentLifeCycle', () => {
211
212 expect(() => {
213 ReactTestUtils.renderIntoDocument(<StatefulComponent />);
214 - }).toWarnDev(
214 + }).toErrorDev(
215 'StatefulComponent: It is not recommended to assign props directly to state ' +
216 "because updates to props won't be reflected in state. " +
217 'In most cases, it is better to use props directly.',
@@ -234,7 +234,7 @@ describe('ReactComponentLifeCycle', () => {
234
235 expect(() => {
236 ReactTestUtils.renderIntoDocument(<StatefulComponent />);
237 - }).toWarnDev(
237 + }).toErrorDev(
238 "Warning: Can't call setState on a component that is not yet mounted. " +
239 'This is a no-op, but it might indicate a bug in your application. ' +
240 'Instead, assign to `this.state` directly or define a `state = {};` ' +
@@ -269,7 +269,7 @@ describe('ReactComponentLifeCycle', () => {
269 expect(() => {
270 const instance = ReactTestUtils.renderIntoDocument(element);
271 expect(instance._isMounted()).toBeTruthy();
272 - }).toWarnDev('Component is accessing isMounted inside its render()');
272 + }).toErrorDev('Component is accessing isMounted inside its render()');
273 });
274
275 it('should correctly determine if a null component is mounted', () => {
@@ -296,7 +296,7 @@ describe('ReactComponentLifeCycle', () => {
296 expect(() => {
297 const instance = ReactTestUtils.renderIntoDocument(element);
298 expect(instance._isMounted()).toBeTruthy();
299 - }).toWarnDev('Component is accessing isMounted inside its render()');
299 + }).toErrorDev('Component is accessing isMounted inside its render()');
300 });
301
302 it('isMounted should return false when unmounted', () => {
@@ -334,7 +334,7 @@ describe('ReactComponentLifeCycle', () => {
334
335 expect(() => {
336 ReactTestUtils.renderIntoDocument(<Component />);
337 - }).toWarnDev('Component is accessing findDOMNode inside its render()');
337 + }).toErrorDev('Component is accessing findDOMNode inside its render()');
338 });
339
340 it('should carry through each of the phases of setup', () => {
@@ -398,7 +398,7 @@ describe('ReactComponentLifeCycle', () => {
398 let instance;
399 expect(() => {
400 instance = ReactDOM.render(<LifeCycleComponent />, container);
401 - }).toWarnDev(
401 + }).toErrorDev(
402 'LifeCycleComponent is accessing isMounted inside its render() function',
403 );
404
@@ -694,10 +694,10 @@ describe('ReactComponentLifeCycle', () => {
694
695 const container = document.createElement('div');
696 expect(() => {
697 - expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
697 + expect(() => ReactDOM.render(<Component />, container)).toErrorDev(
698 'Unsafe legacy lifecycles will not be called for components using new component APIs.',
699 );
700 - }).toLowPriorityWarnDev(
700 + }).toWarnDev(
701 [
702 'componentWillMount has been renamed',
703 'componentWillReceiveProps has been renamed',
@@ -732,10 +732,10 @@ describe('ReactComponentLifeCycle', () => {
732 expect(() => {
733 expect(() =>
734 ReactDOM.render(<Component value={1} />, container),
735 - ).toWarnDev(
735 + ).toErrorDev(
736 'Unsafe legacy lifecycles will not be called for components using new component APIs.',
737 );
738 - }).toLowPriorityWarnDev(
738 + }).toWarnDev(
739 [
740 'componentWillMount has been renamed',
741 'componentWillReceiveProps has been renamed',
@@ -767,7 +767,9 @@ describe('ReactComponentLifeCycle', () => {
767 }
768
769 const container = document.createElement('div');
770 - expect(() => ReactDOM.render(<Component value={1} />, container)).toWarnDev(
770 + expect(() =>
771 + ReactDOM.render(<Component value={1} />, container),
772 + ).toErrorDev(
773 'Unsafe legacy lifecycles will not be called for components using new component APIs.',
774 );
775 ReactDOM.render(<Component value={2} />, container);
@@ -792,7 +794,7 @@ describe('ReactComponentLifeCycle', () => {
794 expect(() => {
795 expect(() =>
796 ReactDOM.render(<AllLegacyLifecycles />, container),
795 - ).toWarnDev(
797 + ).toErrorDev(
798 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
799 'AllLegacyLifecycles uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
800 ' componentWillMount\n' +
@@ -801,7 +803,7 @@ describe('ReactComponentLifeCycle', () => {
803 'The above lifecycles should be removed. Learn more about this warning here:\n' +
804 'https://fb.me/react-unsafe-component-lifecycles',
805 );
804 - }).toLowPriorityWarnDev(
806 + }).toWarnDev(
807 [
808 'componentWillMount has been renamed',
809 'componentWillUpdate has been renamed',
@@ -820,7 +822,7 @@ describe('ReactComponentLifeCycle', () => {
822 }
823 }
824
823 - expect(() => ReactDOM.render(<WillMount />, container)).toWarnDev(
825 + expect(() => ReactDOM.render(<WillMount />, container)).toErrorDev(
826 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
827 'WillMount uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
828 ' UNSAFE_componentWillMount\n\n' +
@@ -843,7 +845,7 @@ describe('ReactComponentLifeCycle', () => {
845 expect(() => {
846 expect(() =>
847 ReactDOM.render(<WillMountAndUpdate />, container),
846 - ).toWarnDev(
848 + ).toErrorDev(
849 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
850 'WillMountAndUpdate uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
851 ' componentWillMount\n' +
@@ -851,7 +853,7 @@ describe('ReactComponentLifeCycle', () => {
853 'The above lifecycles should be removed. Learn more about this warning here:\n' +
854 'https://fb.me/react-unsafe-component-lifecycles',
855 );
854 - }).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
856 + }).toWarnDev(['componentWillMount has been renamed'], {
857 withoutStack: true,
858 });
859
@@ -867,14 +869,14 @@ describe('ReactComponentLifeCycle', () => {
869 }
870
871 expect(() => {
870 - expect(() => ReactDOM.render(<WillReceiveProps />, container)).toWarnDev(
872 + expect(() => ReactDOM.render(<WillReceiveProps />, container)).toErrorDev(
873 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
874 'WillReceiveProps uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
875 ' componentWillReceiveProps\n\n' +
876 'The above lifecycles should be removed. Learn more about this warning here:\n' +
877 'https://fb.me/react-unsafe-component-lifecycles',
878 );
877 - }).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
879 + }).toWarnDev(['componentWillReceiveProps has been renamed'], {
880 withoutStack: true,
881 });
882 });
@@ -897,7 +899,7 @@ describe('ReactComponentLifeCycle', () => {
899 expect(() => {
900 expect(() =>
901 ReactDOM.render(<AllLegacyLifecycles />, container),
900 - ).toWarnDev(
902 + ).toErrorDev(
903 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
904 'AllLegacyLifecycles uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
905 ' componentWillMount\n' +
@@ -906,7 +908,7 @@ describe('ReactComponentLifeCycle', () => {
908 'The above lifecycles should be removed. Learn more about this warning here:\n' +
909 'https://fb.me/react-unsafe-component-lifecycles',
910 );
909 - }).toLowPriorityWarnDev(
911 + }).toWarnDev(
912 [
913 'componentWillMount has been renamed',
914 'componentWillUpdate has been renamed',
@@ -924,7 +926,7 @@ describe('ReactComponentLifeCycle', () => {
926 }
927 }
928
927 - expect(() => ReactDOM.render(<WillMount />, container)).toWarnDev(
929 + expect(() => ReactDOM.render(<WillMount />, container)).toErrorDev(
930 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
931 'WillMount uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
932 ' UNSAFE_componentWillMount\n\n' +
@@ -946,7 +948,7 @@ describe('ReactComponentLifeCycle', () => {
948 expect(() => {
949 expect(() =>
950 ReactDOM.render(<WillMountAndUpdate />, container),
949 - ).toWarnDev(
951 + ).toErrorDev(
952 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
953 'WillMountAndUpdate uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
954 ' componentWillMount\n' +
@@ -954,7 +956,7 @@ describe('ReactComponentLifeCycle', () => {
956 'The above lifecycles should be removed. Learn more about this warning here:\n' +
957 'https://fb.me/react-unsafe-component-lifecycles',
958 );
957 - }).toLowPriorityWarnDev(['componentWillMount has been renamed'], {
959 + }).toWarnDev(['componentWillMount has been renamed'], {
960 withoutStack: true,
961 });
962
@@ -969,14 +971,14 @@ describe('ReactComponentLifeCycle', () => {
971 }
972
973 expect(() => {
972 - expect(() => ReactDOM.render(<WillReceiveProps />, container)).toWarnDev(
974 + expect(() => ReactDOM.render(<WillReceiveProps />, container)).toErrorDev(
975 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
976 'WillReceiveProps uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
977 ' componentWillReceiveProps\n\n' +
978 'The above lifecycles should be removed. Learn more about this warning here:\n' +
979 'https://fb.me/react-unsafe-component-lifecycles',
980 );
979 - }).toLowPriorityWarnDev(['componentWillReceiveProps has been renamed'], {
981 + }).toWarnDev(['componentWillReceiveProps has been renamed'], {
982 withoutStack: true,
983 });
984 });
@@ -1019,7 +1021,7 @@ describe('ReactComponentLifeCycle', () => {
1021 const div = document.createElement('div');
1022 expect(() =>
1023 ReactDOM.render(<Parent ref={c => c && log.push('ref')} />, div),
1022 - ).toWarnDev(
1024 + ).toErrorDev(
1025 'Warning: The <Parent /> component appears to be a function component that returns a class instance. ' +
1026 'Change Parent to a class that extends React.Component instead. ' +
1027 "If you can't use a class try assigning the prototype on the function as a workaround. " +
@@ -1050,7 +1052,7 @@ describe('ReactComponentLifeCycle', () => {
1052 }
1053
1054 const div = document.createElement('div');
1053 - expect(() => ReactDOM.render(<MyComponent />, div)).toWarnDev(
1055 + expect(() => ReactDOM.render(<MyComponent />, div)).toErrorDev(
1056 'MyComponent.getDerivedStateFromProps(): A valid state object (or null) must ' +
1057 'be returned. You have returned undefined.',
1058 );
@@ -1070,7 +1072,7 @@ describe('ReactComponentLifeCycle', () => {
1072 }
1073
1074 const div = document.createElement('div');
1073 - expect(() => ReactDOM.render(<MyComponent />, div)).toWarnDev(
1075 + expect(() => ReactDOM.render(<MyComponent />, div)).toErrorDev(
1076 '`MyComponent` uses `getDerivedStateFromProps` but its initial state is ' +
1077 'undefined. This is not recommended. Instead, define the initial state by ' +
1078 'assigning an object to `this.state` in the constructor of `MyComponent`. ' +
@@ -1109,9 +1111,7 @@ describe('ReactComponentLifeCycle', () => {
1111 }
1112
1113 const div = document.createElement('div');
1112 - expect(() =>
1113 - ReactDOM.render(<MyComponent foo="bar" />, div),
1114 - ).toLowPriorityWarnDev(
1114 + expect(() => ReactDOM.render(<MyComponent foo="bar" />, div)).toWarnDev(
1115 [
1116 'componentWillMount has been renamed',
1117 'componentWillReceiveProps has been renamed',
@@ -1340,7 +1340,7 @@ describe('ReactComponentLifeCycle', () => {
1340
1341 const div = document.createElement('div');
1342 ReactDOM.render(<MyComponent value="foo" />, div);
1343 - expect(() => ReactDOM.render(<MyComponent value="bar" />, div)).toWarnDev(
1343 + expect(() => ReactDOM.render(<MyComponent value="bar" />, div)).toErrorDev(
1344 'MyComponent.getSnapshotBeforeUpdate(): A snapshot value (or null) must ' +
1345 'be returned. You have returned undefined.',
1346 );
@@ -1360,7 +1360,7 @@ describe('ReactComponentLifeCycle', () => {
1360 }
1361
1362 const div = document.createElement('div');
1363 - expect(() => ReactDOM.render(<MyComponent />, div)).toWarnDev(
1363 + expect(() => ReactDOM.render(<MyComponent />, div)).toErrorDev(
1364 'MyComponent: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' +
1365 'This component defines getSnapshotBeforeUpdate() only.',
1366 );
@@ -1380,9 +1380,7 @@ describe('ReactComponentLifeCycle', () => {
1380 }
1381
1382 const container = document.createElement('div');
1383 - expect(() =>
1384 - ReactDOM.render(<MyComponent x={1} />, container),
1385 - ).toLowPriorityWarnDev(
1383 + expect(() => ReactDOM.render(<MyComponent x={1} />, container)).toWarnDev(
1384 [
1385 /* eslint-disable max-len */
1386 `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
+18 -18
@@ -118,7 +118,7 @@ describe('ReactCompositeComponent', () => {
118 }
119
120 const el = document.createElement('div');
121 - expect(() => ReactDOM.render(<Child test="test" />, el)).toWarnDev(
121 + expect(() => ReactDOM.render(<Child test="test" />, el)).toErrorDev(
122 'Warning: The <Child /> component appears to be a function component that returns a class instance. ' +
123 'Change Child to a class that extends React.Component instead. ' +
124 "If you can't use a class try assigning the prototype on the function as a workaround. " +
@@ -165,7 +165,7 @@ describe('ReactCompositeComponent', () => {
165 // Old API based on heuristic
166 let container = document.createElement('div');
167 container.innerHTML = markup;
168 - expect(() => ReactDOM.render(<Parent />, container)).toLowPriorityWarnDev(
168 + expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
169 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
170 'will stop working in React v17. Replace the ReactDOM.render() call ' +
171 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
@@ -281,7 +281,7 @@ describe('ReactCompositeComponent', () => {
281 }
282
283 const container = document.createElement('div');
284 - expect(() => ReactDOM.render(<MyComponent />, container)).toWarnDev(
284 + expect(() => ReactDOM.render(<MyComponent />, container)).toErrorDev(
285 "Warning: Can't call forceUpdate on a component that is not yet mounted. " +
286 'This is a no-op, but it might indicate a bug in your application. ' +
287 'Instead, assign to `this.state` directly or define a `state = {};` ' +
@@ -305,7 +305,7 @@ describe('ReactCompositeComponent', () => {
305 }
306
307 const container = document.createElement('div');
308 - expect(() => ReactDOM.render(<MyComponent />, container)).toWarnDev(
308 + expect(() => ReactDOM.render(<MyComponent />, container)).toErrorDev(
309 "Warning: Can't call setState on a component that is not yet mounted. " +
310 'This is a no-op, but it might indicate a bug in your application. ' +
311 'Instead, assign to `this.state` directly or define a `state = {};` ' +
@@ -335,7 +335,7 @@ describe('ReactCompositeComponent', () => {
335
336 ReactDOM.unmountComponentAtNode(container);
337
338 - expect(() => instance.forceUpdate()).toWarnDev(
338 + expect(() => instance.forceUpdate()).toErrorDev(
339 "Warning: Can't perform a React state update on an unmounted " +
340 'component. This is a no-op, but it indicates a memory leak in your ' +
341 'application. To fix, cancel all subscriptions and asynchronous ' +
@@ -382,7 +382,7 @@ describe('ReactCompositeComponent', () => {
382
383 expect(() => {
384 instance.setState({value: 2});
385 - }).toWarnDev(
385 + }).toErrorDev(
386 "Warning: Can't perform a React state update on an unmounted " +
387 'component. This is a no-op, but it indicates a memory leak in your ' +
388 'application. To fix, cancel all subscriptions and asynchronous ' +
@@ -433,7 +433,7 @@ describe('ReactCompositeComponent', () => {
433 expect(() => {
434 ReactDOM.render(<ClassWithRenderNotExtended />, container);
435 }).toThrow(TypeError);
436 - }).toWarnDev(
436 + }).toErrorDev(
437 'Warning: The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
438 "but doesn't extend React.Component. This is likely to cause errors. " +
439 'Change ClassWithRenderNotExtended to extend React.Component instead.',
@@ -468,7 +468,7 @@ describe('ReactCompositeComponent', () => {
468
469 expect(() => {
470 instance = ReactDOM.render(<Component />, container);
471 - }).toWarnDev(
471 + }).toErrorDev(
472 'Cannot update during an existing state transition (such as within ' +
473 '`render`). Render methods should be a pure function of props and state.',
474 );
@@ -516,7 +516,7 @@ describe('ReactCompositeComponent', () => {
516
517 expect(() => {
518 instance = ReactDOM.render(<Component />, container);
519 - }).toWarnDev(
519 + }).toErrorDev(
520 'Warning: setState(...): Cannot call setState() inside getChildContext()',
521 );
522
@@ -591,7 +591,7 @@ describe('ReactCompositeComponent', () => {
591
592 const instance = ReactTestUtils.renderIntoDocument(<Component />);
593
594 - expect(() => instance.setState({bogus: true})).toWarnDev(
594 + expect(() => instance.setState({bogus: true})).toErrorDev(
595 'Warning: Component.shouldComponentUpdate(): Returned undefined instead of a ' +
596 'boolean value. Make sure to return true or false.',
597 );
@@ -606,7 +606,7 @@ describe('ReactCompositeComponent', () => {
606 }
607 }
608
609 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
609 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
610 'Warning: Component has a method called ' +
611 'componentDidUnmount(). But there is no such lifecycle method. ' +
612 'Did you mean componentWillUnmount()?',
@@ -622,7 +622,7 @@ describe('ReactCompositeComponent', () => {
622 }
623 }
624
625 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
625 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
626 'Warning: Component has a method called ' +
627 'componentDidReceiveProps(). But there is no such lifecycle method. ' +
628 'If you meant to update the state in response to changing props, ' +
@@ -643,7 +643,7 @@ describe('ReactCompositeComponent', () => {
643 }
644 }
645
646 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
646 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
647 'Warning: Setting defaultProps as an instance property on Component is not supported ' +
648 'and will be ignored. Instead, define defaultProps as a static property on Component.',
649 );
@@ -1131,7 +1131,7 @@ describe('ReactCompositeComponent', () => {
1131 }
1132 }
1133
1134 - expect(() => ReactTestUtils.renderIntoDocument(<Outer />)).toWarnDev(
1134 + expect(() => ReactTestUtils.renderIntoDocument(<Outer />)).toErrorDev(
1135 'Render methods should be a pure function of props and state; ' +
1136 'triggering nested component updates from render is not allowed. If ' +
1137 'necessary, trigger nested updates in componentDidUpdate.\n\nCheck the ' +
@@ -1424,7 +1424,7 @@ describe('ReactCompositeComponent', () => {
1424 }
1425 }
1426
1427 - expect(() => ReactDOM.render(<Foo idx="qwe" />, container)).toWarnDev(
1427 + expect(() => ReactDOM.render(<Foo idx="qwe" />, container)).toErrorDev(
1428 'Foo(...): When calling super() in `Foo`, make sure to pass ' +
1429 "up the same props that your component's constructor was passed.",
1430 );
@@ -1725,7 +1725,7 @@ describe('ReactCompositeComponent', () => {
1725 expect(() => {
1726 ReactTestUtils.renderIntoDocument(<RenderTextInvalidConstructor />);
1727 }).toThrow();
1728 - }).toWarnDev([
1728 + }).toErrorDev([
1729 // Expect two errors because invokeGuardedCallback will dispatch an error event,
1730 // Causing the warning to be logged again.
1731 'Warning: RenderTextInvalidConstructor(...): No `render` method found on the returned component instance: ' +
@@ -1748,7 +1748,7 @@ describe('ReactCompositeComponent', () => {
1748 const container = document.createElement('div');
1749 expect(() => {
1750 ReactDOM.render(<Bad />, container);
1751 - }).toWarnDev(
1751 + }).toErrorDev(
1752 'It looks like Bad is reassigning its own `this.props` while rendering. ' +
1753 'This is not supported and can lead to confusing bugs.',
1754 );
@@ -1761,7 +1761,7 @@ describe('ReactCompositeComponent', () => {
1761 expect(() => {
1762 ReactTestUtils.renderIntoDocument(<RenderTestUndefinedRender />);
1763 }).toThrow();
1764 - }).toWarnDev([
1764 + }).toErrorDev([
1765 // Expect two errors because invokeGuardedCallback will dispatch an error event,
1766 // Causing the warning to be logged again.
1767 'Warning: RenderTestUndefinedRender(...): No `render` method found on the returned ' +
packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js
+3 -3
@@ -406,7 +406,7 @@ describe('ReactCompositeComponent-state', () => {
406 const container = document.createElement('div');
407 ReactDOM.render(<Test />, container);
408 // Update
409 - expect(() => ReactDOM.render(<Test />, container)).toWarnDev(
409 + expect(() => ReactDOM.render(<Test />, container)).toErrorDev(
410 'Warning: Test.componentWillReceiveProps(): Assigning directly to ' +
411 "this.state is deprecated (except inside a component's constructor). " +
412 'Use setState instead.',
@@ -447,7 +447,7 @@ describe('ReactCompositeComponent-state', () => {
447
448 // Mount
449 const container = document.createElement('div');
450 - expect(() => ReactDOM.render(<Test />, container)).toWarnDev(
450 + expect(() => ReactDOM.render(<Test />, container)).toErrorDev(
451 'Warning: Test.componentWillMount(): Assigning directly to ' +
452 "this.state is deprecated (except inside a component's constructor). " +
453 'Use setState instead.',
@@ -472,7 +472,7 @@ describe('ReactCompositeComponent-state', () => {
472 }
473
474 const el = document.createElement('div');
475 - expect(() => ReactDOM.render(<Child />, el)).toWarnDev(
475 + expect(() => ReactDOM.render(<Child />, el)).toErrorDev(
476 'Warning: The <Child /> component appears to be a function component that returns a class instance. ' +
477 'Change Child to a class that extends React.Component instead. ' +
478 "If you can't use a class try assigning the prototype on the function as a workaround. " +
packages/react-dom/src/__tests__/ReactDOM-test.js
+7 -7
@@ -139,7 +139,7 @@ describe('ReactDOM', () => {
139 expect(() => {
140 expect(() => {
141 ReactDOM.render(<A />, myDiv, 'no');
142 - }).toWarnDev(
142 + }).toErrorDev(
143 'render(...): Expected the last optional `callback` argument to be ' +
144 'a function. Instead received: no.',
145 );
@@ -151,7 +151,7 @@ describe('ReactDOM', () => {
151 expect(() => {
152 expect(() => {
153 ReactDOM.render(<A />, myDiv, {foo: 'bar'});
154 - }).toWarnDev(
154 + }).toErrorDev(
155 'render(...): Expected the last optional `callback` argument to be ' +
156 'a function. Instead received: [object Object].',
157 );
@@ -163,7 +163,7 @@ describe('ReactDOM', () => {
163 expect(() => {
164 expect(() => {
165 ReactDOM.render(<A />, myDiv, new Foo());
166 - }).toWarnDev(
166 + }).toErrorDev(
167 'render(...): Expected the last optional `callback` argument to be ' +
168 'a function. Instead received: [object Object].',
169 );
@@ -192,7 +192,7 @@ describe('ReactDOM', () => {
192 expect(() => {
193 expect(() => {
194 ReactDOM.render(<A />, myDiv, 'no');
195 - }).toWarnDev(
195 + }).toErrorDev(
196 'render(...): Expected the last optional `callback` argument to be ' +
197 'a function. Instead received: no.',
198 );
@@ -205,7 +205,7 @@ describe('ReactDOM', () => {
205 expect(() => {
206 expect(() => {
207 ReactDOM.render(<A />, myDiv, {foo: 'bar'});
208 - }).toWarnDev(
208 + }).toErrorDev(
209 'render(...): Expected the last optional `callback` argument to be ' +
210 'a function. Instead received: [object Object].',
211 );
@@ -218,7 +218,7 @@ describe('ReactDOM', () => {
218 expect(() => {
219 expect(() => {
220 ReactDOM.render(<A />, myDiv, new Foo());
221 - }).toWarnDev(
221 + }).toErrorDev(
222 'render(...): Expected the last optional `callback` argument to be ' +
223 'a function. Instead received: [object Object].',
224 );
@@ -484,7 +484,7 @@ describe('ReactDOM', () => {
484 }
485
486 const container = document.createElement('div');
487 - expect(() => ReactDOM.render(<App />, container)).toWarnDev([
487 + expect(() => ReactDOM.render(<App />, container)).toErrorDev([
488 // ReactDOM(App > div > span)
489 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
490 ' in span (at **)\n' +
packages/react-dom/src/__tests__/ReactDOMAttribute-test.js
+5 -5
@@ -42,7 +42,7 @@ describe('ReactDOM unknown attribute', () => {
42 });
43
44 it('changes values true, false to null, and also warns once', () => {
45 - expect(() => testUnknownAttributeAssignment(true, null)).toWarnDev(
45 + expect(() => testUnknownAttributeAssignment(true, null)).toErrorDev(
46 'Received `true` for a non-boolean attribute `unknown`.\n\n' +
47 'If you want to write it to the DOM, pass a string instead: ' +
48 'unknown="true" or unknown={value.toString()}.\n' +
@@ -71,7 +71,7 @@ describe('ReactDOM unknown attribute', () => {
71 });
72
73 it('coerces NaN to strings and warns', () => {
74 - expect(() => testUnknownAttributeAssignment(NaN, 'NaN')).toWarnDev(
74 + expect(() => testUnknownAttributeAssignment(NaN, 'NaN')).toErrorDev(
75 'Warning: Received NaN for the `unknown` attribute. ' +
76 'If this is expected, cast the value to a string.\n' +
77 ' in div (at **)',
@@ -90,7 +90,7 @@ describe('ReactDOM unknown attribute', () => {
90 });
91
92 it('removes symbols and warns', () => {
93 - expect(() => testUnknownAttributeRemoval(Symbol('foo'))).toWarnDev(
93 + expect(() => testUnknownAttributeRemoval(Symbol('foo'))).toErrorDev(
94 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove it ' +
95 'from the element, or pass a string or number value to keep it ' +
96 'in the DOM. For details, see https://fb.me/react-attribute-behavior\n' +
@@ -101,7 +101,7 @@ describe('ReactDOM unknown attribute', () => {
101 it('removes functions and warns', () => {
102 expect(() =>
103 testUnknownAttributeRemoval(function someFunction() {}),
104 - ).toWarnDev(
104 + ).toErrorDev(
105 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove ' +
106 'it from the element, or pass a string or number value to ' +
107 'keep it in the DOM. For details, see ' +
@@ -115,7 +115,7 @@ describe('ReactDOM unknown attribute', () => {
115
116 expect(() =>
117 ReactDOM.render(<div helloWorld="something" />, el),
118 - ).toWarnDev(
118 + ).toErrorDev(
119 'React does not recognize the `helloWorld` prop on a DOM element. ' +
120 'If you intentionally want it to appear in the DOM as a custom ' +
121 'attribute, spell it as lowercase `helloworld` instead. ' +
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+84 -84
@@ -150,7 +150,7 @@ describe('ReactDOMComponent', () => {
150 const container = document.createElement('div');
151 expect(() =>
152 ReactDOM.render(<div foo={() => {}} />, container),
153 - ).toWarnDev(
153 + ).toErrorDev(
154 'Warning: Invalid value for prop `foo` on <div> tag. Either remove it ' +
155 'from the element, or pass a string or number value to keep ' +
156 'it in the DOM. For details, see https://fb.me/react-attribute-behavior' +
@@ -162,7 +162,7 @@ describe('ReactDOMComponent', () => {
162 const container = document.createElement('div');
163 expect(() =>
164 ReactDOM.render(<div foo={() => {}} baz={() => {}} />, container),
165 - ).toWarnDev(
165 + ).toErrorDev(
166 'Warning: Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
167 'them from the element, or pass a string or number value to keep ' +
168 'them in the DOM. For details, see https://fb.me/react-attribute-behavior' +
@@ -174,7 +174,7 @@ describe('ReactDOMComponent', () => {
174 const container = document.createElement('div');
175 expect(() =>
176 ReactDOM.render(<div onDblClick={() => {}} />, container),
177 - ).toWarnDev(
177 + ).toErrorDev(
178 'Warning: Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
179 );
180 });
@@ -183,14 +183,14 @@ describe('ReactDOMComponent', () => {
183 const container = document.createElement('div');
184 expect(() =>
185 ReactDOM.render(<div onUnknown="alert(&quot;hack&quot;)" />, container),
186 - ).toWarnDev(
186 + ).toErrorDev(
187 'Warning: Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
188 );
189 expect(container.firstChild.hasAttribute('onUnknown')).toBe(false);
190 expect(container.firstChild.onUnknown).toBe(undefined);
191 expect(() =>
192 ReactDOM.render(<div onunknown="alert(&quot;hack&quot;)" />, container),
193 - ).toWarnDev(
193 + ).toErrorDev(
194 'Warning: Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
195 );
196 expect(container.firstChild.hasAttribute('onunknown')).toBe(false);
@@ -200,7 +200,7 @@ describe('ReactDOMComponent', () => {
200 <div on-unknown="alert(&quot;hack&quot;)" />,
201 container,
202 ),
203 - ).toWarnDev(
203 + ).toErrorDev(
204 'Warning: Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
205 );
206 expect(container.firstChild.hasAttribute('on-unknown')).toBe(false);
@@ -211,21 +211,21 @@ describe('ReactDOMComponent', () => {
211 const container = document.createElement('div');
212 expect(() =>
213 ReactDOM.render(<div onUnknown={function() {}} />, container),
214 - ).toWarnDev(
214 + ).toErrorDev(
215 'Warning: Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
216 );
217 expect(container.firstChild.hasAttribute('onUnknown')).toBe(false);
218 expect(container.firstChild.onUnknown).toBe(undefined);
219 expect(() =>
220 ReactDOM.render(<div onunknown={function() {}} />, container),
221 - ).toWarnDev(
221 + ).toErrorDev(
222 'Warning: Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
223 );
224 expect(container.firstChild.hasAttribute('onunknown')).toBe(false);
225 expect(container.firstChild.onunknown).toBe(undefined);
226 expect(() =>
227 ReactDOM.render(<div on-unknown={function() {}} />, container),
228 - ).toWarnDev(
228 + ).toErrorDev(
229 'Warning: Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
230 );
231 expect(container.firstChild.hasAttribute('on-unknown')).toBe(false);
@@ -234,7 +234,7 @@ describe('ReactDOMComponent', () => {
234
235 it('should warn for badly cased React attributes', () => {
236 const container = document.createElement('div');
237 - expect(() => ReactDOM.render(<div CHILDREN="5" />, container)).toWarnDev(
237 + expect(() => ReactDOM.render(<div CHILDREN="5" />, container)).toErrorDev(
238 'Warning: Invalid DOM property `CHILDREN`. Did you mean `children`?\n in div (at **)',
239 );
240 expect(container.firstChild.getAttribute('CHILDREN')).toBe('5');
@@ -253,7 +253,7 @@ describe('ReactDOMComponent', () => {
253 it('should warn nicely about NaN in style', () => {
254 const style = {fontSize: NaN};
255 const div = document.createElement('div');
256 - expect(() => ReactDOM.render(<span style={style} />, div)).toWarnDev(
256 + expect(() => ReactDOM.render(<span style={style} />, div)).toErrorDev(
257 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
258 '\n in span (at **)',
259 );
@@ -572,7 +572,7 @@ describe('ReactDOMComponent', () => {
572 expect(result1.toLowerCase()).not.toContain('onclick');
573 expect(result2.toLowerCase()).not.toContain('script');
574 }
575 - }).toWarnDev([
575 + }).toErrorDev([
576 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
577 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
578 ]);
@@ -596,7 +596,7 @@ describe('ReactDOMComponent', () => {
596 expect(result1.toLowerCase()).not.toContain('onclick');
597 expect(result2.toLowerCase()).not.toContain('script');
598 }
599 - }).toWarnDev([
599 + }).toErrorDev([
600 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
601 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
602 ]);
@@ -626,7 +626,7 @@ describe('ReactDOMComponent', () => {
626 );
627 expect(container.firstChild.attributes.length).toBe(0);
628 }
629 - }).toWarnDev([
629 + }).toErrorDev([
630 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
631 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
632 ]);
@@ -656,7 +656,7 @@ describe('ReactDOMComponent', () => {
656 );
657 expect(container.firstChild.attributes.length).toBe(0);
658 }
659 - }).toWarnDev([
659 + }).toErrorDev([
660 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
661 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
662 ]);
@@ -687,7 +687,7 @@ describe('ReactDOMComponent', () => {
687 );
688 expect(container.firstChild.attributes.length).toBe(0);
689 }
690 - }).toWarnDev([
690 + }).toErrorDev([
691 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
692 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
693 ]);
@@ -718,7 +718,7 @@ describe('ReactDOMComponent', () => {
718 );
719 expect(container.firstChild.attributes.length).toBe(0);
720 }
721 - }).toWarnDev([
721 + }).toErrorDev([
722 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
723 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
724 ]);
@@ -969,7 +969,7 @@ describe('ReactDOMComponent', () => {
969 const container = document.createElement('div');
970 expect(() =>
971 ReactDOM.render(<button is={function() {}} />, container),
972 - ).toWarnDev(
972 + ).toErrorDev(
973 'Received a `function` for a string attribute `is`. If this is expected, cast ' +
974 'the value to a string.',
975 );
@@ -1133,7 +1133,7 @@ describe('ReactDOMComponent', () => {
1133
1134 expect(() => {
1135 returnedValue = ReactDOMServer.renderToString(<Container />);
1136 - }).toWarnDev(
1136 + }).toErrorDev(
1137 '<BR /> is using incorrect casing. ' +
1138 'Use PascalCase for React components, ' +
1139 'or lowercase for HTML elements.',
@@ -1149,7 +1149,7 @@ describe('ReactDOMComponent', () => {
1149
1150 expect(() =>
1151 ReactTestUtils.renderIntoDocument(React.createElement('IMG')),
1152 - ).toWarnDev(
1152 + ).toErrorDev(
1153 '<IMG /> is using incorrect casing. ' +
1154 'Use PascalCase for React components, ' +
1155 'or lowercase for HTML elements.',
@@ -1159,7 +1159,7 @@ describe('ReactDOMComponent', () => {
1159 it('should warn on props reserved for future use', () => {
1160 expect(() =>
1161 ReactTestUtils.renderIntoDocument(<div aria="hello" />),
1162 - ).toWarnDev(
1162 + ).toErrorDev(
1163 'The `aria` attribute is reserved for future use in React. ' +
1164 'Pass individual `aria-` attributes instead.',
1165 );
@@ -1182,11 +1182,11 @@ describe('ReactDOMComponent', () => {
1182 };
1183 Object.prototype.toString = wrappedToString; // eslint-disable-line no-extend-native
1184
1185 - expect(() => ReactTestUtils.renderIntoDocument(<bar />)).toWarnDev(
1185 + expect(() => ReactTestUtils.renderIntoDocument(<bar />)).toErrorDev(
1186 'The tag <bar> is unrecognized in this browser',
1187 );
1188 // Test deduplication
1189 - expect(() => ReactTestUtils.renderIntoDocument(<foo />)).toWarnDev(
1189 + expect(() => ReactTestUtils.renderIntoDocument(<foo />)).toErrorDev(
1190 'The tag <foo> is unrecognized in this browser',
1191 );
1192 ReactTestUtils.renderIntoDocument(<foo />);
@@ -1199,7 +1199,7 @@ describe('ReactDOMComponent', () => {
1199 // Corner case. Make sure out deduplication logic doesn't break with weird tag.
1200 expect(() =>
1201 ReactTestUtils.renderIntoDocument(<hasOwnProperty />),
1202 - ).toWarnDev([
1202 + ).toErrorDev([
1203 '<hasOwnProperty /> is using incorrect casing. ' +
1204 'Use PascalCase for React components, ' +
1205 'or lowercase for HTML elements.',
@@ -1260,7 +1260,7 @@ describe('ReactDOMComponent', () => {
1260 }
1261 }
1262 const node = document.createElement('div');
1263 - expect(() => ReactDOM.render(<ShadyComponent />, node)).toWarnDev(
1263 + expect(() => ReactDOM.render(<ShadyComponent />, node)).toErrorDev(
1264 'ShadyComponent is using shady DOM. Using shady DOM with React can ' +
1265 'cause things to break subtly.',
1266 );
@@ -1280,7 +1280,7 @@ describe('ReactDOMComponent', () => {
1280 return container;
1281 };
1282
1283 - expect(() => mountComponent({is: 'custom-shady-div'})).toWarnDev(
1283 + expect(() => mountComponent({is: 'custom-shady-div'})).toErrorDev(
1284 'A component is using shady DOM. Using shady DOM with React can ' +
1285 'cause things to break subtly.',
1286 );
@@ -1312,7 +1312,7 @@ describe('ReactDOMComponent', () => {
1312 </menu>,
1313 container,
1314 );
1315 - }).toWarnDev('The tag <menuitem> is unrecognized in this browser.');
1315 + }).toErrorDev('The tag <menuitem> is unrecognized in this browser.');
1316 }).toThrowError(
1317 'menuitem is a void element tag and must neither have `children` nor use ' +
1318 '`dangerouslySetInnerHTML`.',
@@ -1330,13 +1330,13 @@ describe('ReactDOMComponent', () => {
1330 it('should validate against use of innerHTML', () => {
1331 expect(() =>
1332 mountComponent({innerHTML: '<span>Hi Jim!</span>'}),
1333 - ).toWarnDev('Directly setting property `innerHTML` is not permitted. ');
1333 + ).toErrorDev('Directly setting property `innerHTML` is not permitted. ');
1334 });
1335
1336 it('should validate against use of innerHTML without case sensitivity', () => {
1337 expect(() =>
1338 mountComponent({innerhtml: '<span>Hi Jim!</span>'}),
1339 - ).toWarnDev('Directly setting property `innerHTML` is not permitted. ');
1339 + ).toErrorDev('Directly setting property `innerHTML` is not permitted. ');
1340 });
1341
1342 it('should validate use of dangerouslySetInnerHTML', () => {
@@ -1366,7 +1366,7 @@ describe('ReactDOMComponent', () => {
1366 it('should warn about contentEditable and children', () => {
1367 expect(() =>
1368 mountComponent({contentEditable: true, children: ''}),
1369 - ).toWarnDev(
1369 + ).toErrorDev(
1370 'Warning: A component is `contentEditable` and contains `children` ' +
1371 'managed by React. It is now your responsibility to guarantee that ' +
1372 'none of those nodes are unexpectedly modified or duplicated. This ' +
@@ -1544,7 +1544,7 @@ describe('ReactDOMComponent', () => {
1544 </div>,
1545 container,
1546 );
1547 - }).toWarnDev('contentEditable');
1547 + }).toErrorDev('contentEditable');
1548 });
1549
1550 it('should validate against invalid styles', () => {
@@ -1663,7 +1663,7 @@ describe('ReactDOMComponent', () => {
1663 <tr />
1664 </div>,
1665 );
1666 - }).toWarnDev([
1666 + }).toErrorDev([
1667 'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
1668 '<div>.' +
1669 '\n in tr (at **)' +
@@ -1685,7 +1685,7 @@ describe('ReactDOMComponent', () => {
1685 </span>,
1686 p,
1687 );
1688 - }).toWarnDev(
1688 + }).toErrorDev(
1689 'Warning: validateDOMNesting(...): <p> cannot appear as a descendant ' +
1690 'of <p>.' +
1691 // There is no outer `p` here because root container is not part of the stack.
@@ -1711,7 +1711,7 @@ describe('ReactDOMComponent', () => {
1711 }
1712 }
1713
1714 - expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toWarnDev([
1714 + expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toErrorDev([
1715 'Warning: validateDOMNesting(...): <tr> cannot appear as a child of ' +
1716 '<table>. Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated ' +
1717 'by the browser.' +
@@ -1763,7 +1763,7 @@ describe('ReactDOMComponent', () => {
1763 function App1() {
1764 return <Viz1 />;
1765 }
1766 - expect(() => ReactTestUtils.renderIntoDocument(<App1 />)).toWarnDev(
1766 + expect(() => ReactTestUtils.renderIntoDocument(<App1 />)).toErrorDev(
1767 '\n in tr (at **)' +
1768 '\n in Row (at **)' +
1769 '\n in FancyRow (at **)' +
@@ -1781,7 +1781,7 @@ describe('ReactDOMComponent', () => {
1781 function App2() {
1782 return <Viz2 />;
1783 }
1784 - expect(() => ReactTestUtils.renderIntoDocument(<App2 />)).toWarnDev(
1784 + expect(() => ReactTestUtils.renderIntoDocument(<App2 />)).toErrorDev(
1785 '\n in tr (at **)' +
1786 '\n in Row (at **)' +
1787 '\n in FancyRow (at **)' +
@@ -1797,7 +1797,7 @@ describe('ReactDOMComponent', () => {
1797 <FancyRow />
1798 </FancyTable>,
1799 );
1800 - }).toWarnDev(
1800 + }).toErrorDev(
1801 '\n in tr (at **)' +
1802 '\n in Row (at **)' +
1803 '\n in FancyRow (at **)' +
@@ -1812,7 +1812,7 @@ describe('ReactDOMComponent', () => {
1812 <FancyRow />
1813 </table>,
1814 );
1815 - }).toWarnDev(
1815 + }).toErrorDev(
1816 '\n in tr (at **)' +
1817 '\n in Row (at **)' +
1818 '\n in FancyRow (at **)' +
@@ -1825,7 +1825,7 @@ describe('ReactDOMComponent', () => {
1825 <tr />
1826 </FancyTable>,
1827 );
1828 - }).toWarnDev(
1828 + }).toErrorDev(
1829 '\n in tr (at **)' +
1830 '\n in table (at **)' +
1831 '\n in Table (at **)' +
@@ -1846,7 +1846,7 @@ describe('ReactDOMComponent', () => {
1846 </div>
1847 </Link>,
1848 );
1849 - }).toWarnDev(
1849 + }).toErrorDev(
1850 '\n in a (at **)' +
1851 '\n in Link (at **)' +
1852 '\n in div (at **)' +
@@ -1860,7 +1860,7 @@ describe('ReactDOMComponent', () => {
1860 ReactDOMServer.renderToString(
1861 React.createElement('input', {type: 'text', tabindex: '1'}),
1862 );
1863 - }).toWarnDev('tabIndex');
1863 + }).toErrorDev('tabIndex');
1864 });
1865
1866 it('should warn about incorrect casing on event handlers (ssr)', () => {
@@ -1868,7 +1868,7 @@ describe('ReactDOMComponent', () => {
1868 ReactDOMServer.renderToString(
1869 React.createElement('input', {type: 'text', oninput: '1'}),
1870 );
1871 - }).toWarnDev(
1871 + }).toErrorDev(
1872 'Invalid event handler property `oninput`. ' +
1873 'React events use the camelCase naming convention, ' +
1874 // Note: we don't know the right event name so we
@@ -1890,7 +1890,7 @@ describe('ReactDOMComponent', () => {
1890 ReactTestUtils.renderIntoDocument(
1891 React.createElement('input', {type: 'text', tabindex: '1'}),
1892 );
1893 - }).toWarnDev('tabIndex');
1893 + }).toErrorDev('tabIndex');
1894 });
1895
1896 it('should warn about incorrect casing on event handlers', () => {
@@ -1898,12 +1898,12 @@ describe('ReactDOMComponent', () => {
1898 ReactTestUtils.renderIntoDocument(
1899 React.createElement('input', {type: 'text', oninput: '1'}),
1900 );
1901 - }).toWarnDev('onInput');
1901 + }).toErrorDev('onInput');
1902 expect(() => {
1903 ReactTestUtils.renderIntoDocument(
1904 React.createElement('input', {type: 'text', onKeydown: '1'}),
1905 );
1906 - }).toWarnDev('onKeyDown');
1906 + }).toErrorDev('onKeyDown');
1907 });
1908
1909 it('should warn about class', () => {
@@ -1911,7 +1911,7 @@ describe('ReactDOMComponent', () => {
1911 ReactTestUtils.renderIntoDocument(
1912 React.createElement('div', {class: 'muffins'}),
1913 );
1914 - }).toWarnDev('className');
1914 + }).toErrorDev('className');
1915 });
1916
1917 it('should warn about class (ssr)', () => {
@@ -1919,7 +1919,7 @@ describe('ReactDOMComponent', () => {
1919 ReactDOMServer.renderToString(
1920 React.createElement('div', {class: 'muffins'}),
1921 );
1922 - }).toWarnDev('className');
1922 + }).toErrorDev('className');
1923 });
1924
1925 it('should warn about props that are no longer supported', () => {
@@ -1927,12 +1927,12 @@ describe('ReactDOMComponent', () => {
1927
1928 expect(() =>
1929 ReactTestUtils.renderIntoDocument(<div onFocusIn={() => {}} />),
1930 - ).toWarnDev(
1930 + ).toErrorDev(
1931 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1932 );
1933 expect(() =>
1934 ReactTestUtils.renderIntoDocument(<div onFocusOut={() => {}} />),
1935 - ).toWarnDev(
1935 + ).toErrorDev(
1936 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1937 );
1938 });
@@ -1941,12 +1941,12 @@ describe('ReactDOMComponent', () => {
1941 ReactTestUtils.renderIntoDocument(<div />);
1942 expect(() =>
1943 ReactTestUtils.renderIntoDocument(<div onfocusin={() => {}} />),
1944 - ).toWarnDev(
1944 + ).toErrorDev(
1945 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1946 );
1947 expect(() =>
1948 ReactTestUtils.renderIntoDocument(<div onfocusout={() => {}} />),
1949 - ).toWarnDev(
1949 + ).toErrorDev(
1950 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1951 );
1952 });
@@ -1955,12 +1955,12 @@ describe('ReactDOMComponent', () => {
1955 ReactDOMServer.renderToString(<div />);
1956 expect(() =>
1957 ReactDOMServer.renderToString(<div onFocusIn={() => {}} />),
1958 - ).toWarnDev(
1958 + ).toErrorDev(
1959 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1960 );
1961 expect(() =>
1962 ReactDOMServer.renderToString(<div onFocusOut={() => {}} />),
1963 - ).toWarnDev(
1963 + ).toErrorDev(
1964 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1965 );
1966 });
@@ -1969,12 +1969,12 @@ describe('ReactDOMComponent', () => {
1969 ReactDOMServer.renderToString(<div />);
1970 expect(() =>
1971 ReactDOMServer.renderToString(<div onfocusin={() => {}} />),
1972 - ).toWarnDev(
1972 + ).toErrorDev(
1973 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1974 );
1975 expect(() =>
1976 ReactDOMServer.renderToString(<div onfocusout={() => {}} />),
1977 - ).toWarnDev(
1977 + ).toErrorDev(
1978 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut.',
1979 );
1980 });
@@ -1982,12 +1982,12 @@ describe('ReactDOMComponent', () => {
1982 it('gives source code refs for unknown prop warning', () => {
1983 expect(() =>
1984 ReactTestUtils.renderIntoDocument(<div class="paladin" />),
1985 - ).toWarnDev(
1985 + ).toErrorDev(
1986 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
1987 );
1988 expect(() =>
1989 ReactTestUtils.renderIntoDocument(<input type="text" onclick="1" />),
1990 - ).toWarnDev(
1990 + ).toErrorDev(
1991 'Warning: Invalid event handler property `onclick`. Did you mean ' +
1992 '`onClick`?\n in input (at **)',
1993 );
@@ -1996,12 +1996,12 @@ describe('ReactDOMComponent', () => {
1996 it('gives source code refs for unknown prop warning (ssr)', () => {
1997 expect(() =>
1998 ReactDOMServer.renderToString(<div class="paladin" />),
1999 - ).toWarnDev(
1999 + ).toErrorDev(
2000 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2001 );
2002 expect(() =>
2003 ReactDOMServer.renderToString(<input type="text" oninput="1" />),
2004 - ).toWarnDev(
2004 + ).toErrorDev(
2005 'Warning: Invalid event handler property `oninput`. ' +
2006 // Note: we don't know the right event name so we
2007 // use a generic one (onClick) as a suggestion.
@@ -2018,7 +2018,7 @@ describe('ReactDOMComponent', () => {
2018 ReactTestUtils.renderIntoDocument(<div className="paladin" />, container);
2019 expect(() =>
2020 ReactTestUtils.renderIntoDocument(<div class="paladin" />, container),
2021 - ).toWarnDev(
2021 + ).toErrorDev(
2022 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2023 );
2024 });
@@ -2034,7 +2034,7 @@ describe('ReactDOMComponent', () => {
2034 <div className="foo6" />
2035 </div>,
2036 ),
2037 - ).toWarnDev([
2037 + ).toErrorDev([
2038 'Invalid DOM property `class`. Did you mean `className`?\n in span (at **)',
2039 'Invalid event handler property `onclick`. Did you mean `onClick`?\n in strong (at **)',
2040 ]);
@@ -2051,7 +2051,7 @@ describe('ReactDOMComponent', () => {
2051 <div className="foo6" />
2052 </div>,
2053 ),
2054 - ).toWarnDev([
2054 + ).toErrorDev([
2055 'Invalid DOM property `class`. Did you mean `className`?\n in span (at **)',
2056 'Invalid event handler property `onclick`. ' +
2057 'React events use the camelCase naming convention, for example `onClick`.' +
@@ -2101,7 +2101,7 @@ describe('ReactDOMComponent', () => {
2101
2102 expect(() =>
2103 ReactTestUtils.renderIntoDocument(<Parent />, container),
2104 - ).toWarnDev([
2104 + ).toErrorDev([
2105 'Invalid DOM property `class`. Did you mean `className`?\n in span (at **)',
2106 'Invalid event handler property `onclick`. Did you mean `onClick`?\n in strong (at **)',
2107 ]);
@@ -2149,7 +2149,7 @@ describe('ReactDOMComponent', () => {
2149
2150 expect(() =>
2151 ReactDOMServer.renderToString(<Parent />, container),
2152 - ).toWarnDev([
2152 + ).toErrorDev([
2153 'Invalid DOM property `class`. Did you mean `className`?\n in span (at **)',
2154 'Invalid event handler property `onclick`. ' +
2155 'React events use the camelCase naming convention, for example `onClick`.' +
@@ -2162,7 +2162,7 @@ describe('ReactDOMComponent', () => {
2162 ReactTestUtils.renderIntoDocument(
2163 React.createElement('label', {for: 'test'}),
2164 ),
2165 - ).toWarnDev(
2165 + ).toErrorDev(
2166 'Warning: Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2167 );
2168
@@ -2170,7 +2170,7 @@ describe('ReactDOMComponent', () => {
2170 ReactTestUtils.renderIntoDocument(
2171 React.createElement('input', {type: 'text', autofocus: true}),
2172 ),
2173 - ).toWarnDev(
2173 + ).toErrorDev(
2174 'Warning: Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2175 );
2176 });
@@ -2180,14 +2180,14 @@ describe('ReactDOMComponent', () => {
2180 ReactDOMServer.renderToString(
2181 React.createElement('label', {for: 'test'}),
2182 ),
2183 - ).toWarnDev(
2183 + ).toErrorDev(
2184 'Warning: Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2185 );
2186 expect(() =>
2187 ReactDOMServer.renderToString(
2188 React.createElement('input', {type: 'text', autofocus: true}),
2189 ),
2190 - ).toWarnDev(
2190 + ).toErrorDev(
2191 'Warning: Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2192 );
2193 });
@@ -2222,7 +2222,7 @@ describe('ReactDOMComponent', () => {
2222 let el;
2223 expect(() => {
2224 el = ReactTestUtils.renderIntoDocument(<div class="test" />);
2225 - }).toWarnDev(
2225 + }).toErrorDev(
2226 'Warning: Invalid DOM property `class`. Did you mean `className`?',
2227 );
2228
@@ -2233,7 +2233,7 @@ describe('ReactDOMComponent', () => {
2233 let el;
2234 expect(() => {
2235 el = ReactTestUtils.renderIntoDocument(<div cLASS="test" />);
2236 - }).toWarnDev(
2236 + }).toErrorDev(
2237 'Warning: Invalid DOM property `cLASS`. Did you mean `className`?',
2238 );
2239
@@ -2248,7 +2248,7 @@ describe('ReactDOMComponent', () => {
2248 <text arabic-form="initial" />
2249 </svg>,
2250 );
2251 - }).toWarnDev(
2251 + }).toErrorDev(
2252 'Warning: Invalid DOM property `arabic-form`. Did you mean `arabicForm`?',
2253 );
2254 const text = el.querySelector('text');
@@ -2303,7 +2303,7 @@ describe('ReactDOMComponent', () => {
2303 let el;
2304 expect(() => {
2305 el = ReactTestUtils.renderIntoDocument(<div whatever={true} />);
2306 - }).toWarnDev(
2306 + }).toErrorDev(
2307 'Received `true` for a non-boolean attribute `whatever`.\n\n' +
2308 'If you want to write it to the DOM, pass a string instead: ' +
2309 'whatever="true" or whatever={value.toString()}.',
@@ -2317,7 +2317,7 @@ describe('ReactDOMComponent', () => {
2317 expect(() => {
2318 // eslint-disable-next-line react/jsx-boolean-value
2319 el = ReactTestUtils.renderIntoDocument(<div whatever />);
2320 - }).toWarnDev(
2320 + }).toErrorDev(
2321 'Received `true` for a non-boolean attribute `whatever`.\n\n' +
2322 'If you want to write it to the DOM, pass a string instead: ' +
2323 'whatever="true" or whatever={value.toString()}.',
@@ -2336,7 +2336,7 @@ describe('ReactDOMComponent', () => {
2336 let el;
2337 expect(() => {
2338 el = ReactTestUtils.renderIntoDocument(<div whatever={() => {}} />);
2339 - }).toWarnDev('Warning: Invalid value for prop `whatever` on <div> tag');
2339 + }).toErrorDev('Warning: Invalid value for prop `whatever` on <div> tag');
2340
2341 expect(el.hasAttribute('whatever')).toBe(false);
2342 });
@@ -2350,7 +2350,7 @@ describe('ReactDOMComponent', () => {
2350 let el;
2351 expect(() => {
2352 el = ReactTestUtils.renderIntoDocument(<div data-fooBar="true" />);
2353 - }).toWarnDev(
2353 + }).toErrorDev(
2354 'React does not recognize the `data-fooBar` prop on a DOM element. ' +
2355 'If you intentionally want it to appear in the DOM as a custom ' +
2356 'attribute, spell it as lowercase `data-foobar` instead. ' +
@@ -2365,7 +2365,7 @@ describe('ReactDOMComponent', () => {
2365 let el;
2366 expect(() => {
2367 el = ReactTestUtils.renderIntoDocument(<div fooBar="true" />);
2368 - }).toWarnDev(
2368 + }).toErrorDev(
2369 'React does not recognize the `fooBar` prop on a DOM element. ' +
2370 'If you intentionally want it to appear in the DOM as a custom ' +
2371 'attribute, spell it as lowercase `foobar` instead. ' +
@@ -2380,7 +2380,7 @@ describe('ReactDOMComponent', () => {
2380 let el;
2381 expect(() => {
2382 el = ReactTestUtils.renderIntoDocument(<div whatever={NaN} />);
2383 - }).toWarnDev(
2383 + }).toErrorDev(
2384 'Warning: Received NaN for the `whatever` attribute. If this is ' +
2385 'expected, cast the value to a string.\n in div',
2386 );
@@ -2393,7 +2393,7 @@ describe('ReactDOMComponent', () => {
2393 ReactDOM.render(<div whatever={0} />, container);
2394 expect(() =>
2395 ReactDOM.render(<div whatever={() => {}} />, container),
2396 - ).toWarnDev('Warning: Invalid value for prop `whatever` on <div> tag.');
2396 + ).toErrorDev('Warning: Invalid value for prop `whatever` on <div> tag.');
2397 const el = container.firstChild;
2398 expect(el.hasAttribute('whatever')).toBe(false);
2399 });
@@ -2402,7 +2402,7 @@ describe('ReactDOMComponent', () => {
2402 let el;
2403 expect(() => {
2404 el = ReactTestUtils.renderIntoDocument(<div SiZe="30" />);
2405 - }).toWarnDev(
2405 + }).toErrorDev(
2406 'Warning: Invalid DOM property `SiZe`. Did you mean `size`?',
2407 );
2408
@@ -2475,7 +2475,7 @@ describe('ReactDOMComponent', () => {
2475 let el;
2476 expect(() => {
2477 el = ReactTestUtils.renderIntoDocument(<div whatever={true} />);
2478 - }).toWarnDev(
2478 + }).toErrorDev(
2479 'Received `true` for a non-boolean attribute `whatever`.\n\n' +
2480 'If you want to write it to the DOM, pass a string instead: ' +
2481 'whatever="true" or whatever={value.toString()}.',
@@ -2509,7 +2509,7 @@ describe('ReactDOMComponent', () => {
2509 let el;
2510 expect(() => {
2511 el = ReactTestUtils.renderIntoDocument(<div hidden="false" />);
2512 - }).toWarnDev(
2512 + }).toErrorDev(
2513 'Received the string `false` for the boolean attribute `hidden`. ' +
2514 'The browser will interpret it as a truthy value. ' +
2515 'Did you mean hidden={false}?',
@@ -2522,7 +2522,7 @@ describe('ReactDOMComponent', () => {
2522 let el;
2523 expect(() => {
2524 el = ReactTestUtils.renderIntoDocument(<div hidden="true" />);
2525 - }).toWarnDev(
2525 + }).toErrorDev(
2526 'Received the string `true` for the boolean attribute `hidden`. ' +
2527 'Although this works, it will not work as expected if you pass the string "false". ' +
2528 'Did you mean hidden={true}?',
@@ -2541,7 +2541,7 @@ describe('ReactDOMComponent', () => {
2541 <font-face x-height={false} />
2542 </svg>,
2543 );
2544 - }).toWarnDev(
2544 + }).toErrorDev(
2545 'Warning: Invalid DOM property `x-height`. Did you mean `xHeight`',
2546 );
2547
@@ -2558,7 +2558,7 @@ describe('ReactDOMComponent', () => {
2558 <font-face whatever={false} />
2559 </svg>,
2560 );
2561 - }).toWarnDev(
2561 + }).toErrorDev(
2562 'Received `false` for a non-boolean attribute `whatever`.\n\n' +
2563 'If you want to write it to the DOM, pass a string instead: ' +
2564 'whatever="false" or whatever={value.toString()}.\n\n' +
packages/react-dom/src/__tests__/ReactDOMComponentTree-test.js
+3 -3
@@ -177,7 +177,7 @@ describe('ReactDOMComponentTree', () => {
177
178 const component = <Controlled />;
179 const instance = ReactDOM.render(component, container);
180 - expect(() => simulateInput(instance.a, finishValue)).toWarnDev(
180 + expect(() => simulateInput(instance.a, finishValue)).toErrorDev(
181 'Warning: A component is changing an uncontrolled input of ' +
182 'type text to be controlled. Input elements should not ' +
183 'switch from uncontrolled to controlled (or vice versa). ' +
@@ -190,7 +190,7 @@ describe('ReactDOMComponentTree', () => {
190 it('finds instance of node that is attempted to be unmounted', () => {
191 const component = <div />;
192 const node = ReactDOM.render(<div>{component}</div>, container);
193 - expect(() => ReactDOM.unmountComponentAtNode(node)).toWarnDev(
193 + expect(() => ReactDOM.unmountComponentAtNode(node)).toErrorDev(
194 "unmountComponentAtNode(): The node you're attempting to unmount " +
195 'was rendered by React and is not a top-level container. You may ' +
196 'have accidentally passed in a React root node instead of its ' +
@@ -207,7 +207,7 @@ describe('ReactDOMComponentTree', () => {
207 );
208 const anotherComponent = <div />;
209 const instance = ReactDOM.render(component, container);
210 - expect(() => ReactDOM.render(anotherComponent, instance)).toWarnDev(
210 + expect(() => ReactDOM.render(anotherComponent, instance)).toErrorDev(
211 'render(...): Replacing React-rendered children with a new root ' +
212 'component. If you intended to update the children of this node, ' +
213 'you should instead have the existing children update their state ' +
packages/react-dom/src/__tests__/ReactDOMFiber-test.js
+7 -7
@@ -257,7 +257,7 @@ describe('ReactDOMFiber', () => {
257 </div>,
258 container,
259 ),
260 - ).toLowPriorityWarnDev(
260 + ).toWarnDev(
261 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
262 'and will be removed in React 17+. Update your code to use ' +
263 'ReactDOM.createPortal() instead. It has the exact same API, ' +
@@ -1002,7 +1002,7 @@ describe('ReactDOMFiber', () => {
1002 return <div onClick="woops" />;
1003 }
1004 }
1005 - expect(() => ReactDOM.render(<Example />, container)).toWarnDev(
1005 + expect(() => ReactDOM.render(<Example />, container)).toErrorDev(
1006 'Expected `onClick` listener to be a function, instead got a value of `string` type.\n' +
1007 ' in div (at **)\n' +
1008 ' in Example (at **)',
@@ -1015,7 +1015,7 @@ describe('ReactDOMFiber', () => {
1015 return <div onClick={false} />;
1016 }
1017 }
1018 - expect(() => ReactDOM.render(<Example />, container)).toWarnDev(
1018 + expect(() => ReactDOM.render(<Example />, container)).toErrorDev(
1019 'Expected `onClick` listener to be a function, instead got `false`.\n\n' +
1020 'If you used to conditionally omit it with onClick={condition && value}, ' +
1021 'pass onClick={condition ? value : undefined} instead.\n' +
@@ -1048,7 +1048,7 @@ describe('ReactDOMFiber', () => {
1048 super();
1049 expect(() => {
1050 node.click();
1051 - }).toWarnDev(
1051 + }).toErrorDev(
1052 'Warning: unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering.',
1053 );
1054 }
@@ -1133,7 +1133,7 @@ describe('ReactDOMFiber', () => {
1133 expect(() => {
1134 expect(() =>
1135 ReactDOM.render(<div key="2">baz</div>, container),
1136 - ).toWarnDev(
1136 + ).toErrorDev(
1137 'render(...): ' +
1138 'It looks like the React-rendered content of this container was ' +
1139 'removed without using React. This is not supported and will ' +
@@ -1151,7 +1151,7 @@ describe('ReactDOMFiber', () => {
1151 expect(container.innerHTML).toBe('<div>bar</div>');
1152 // then we mess with the DOM before an update
1153 container.innerHTML = '<div>MEOW.</div>';
1154 - expect(() => ReactDOM.render(<div>baz</div>, container)).toWarnDev(
1154 + expect(() => ReactDOM.render(<div>baz</div>, container)).toErrorDev(
1155 'render(...): ' +
1156 'It looks like the React-rendered content of this container was ' +
1157 'removed without using React. This is not supported and will ' +
@@ -1168,7 +1168,7 @@ describe('ReactDOMFiber', () => {
1168 expect(container.innerHTML).toBe('<div>bar</div>');
1169 // then we mess with the DOM before an update
1170 container.innerHTML = '';
1171 - expect(() => ReactDOM.render(<div>baz</div>, container)).toWarnDev(
1171 + expect(() => ReactDOM.render(<div>baz</div>, container)).toErrorDev(
1172 'render(...): ' +
1173 'It looks like the React-rendered content of this container was ' +
1174 'removed without using React. This is not supported and will ' +
packages/react-dom/src/__tests__/ReactDOMInput-test.js
+42 -42
@@ -53,7 +53,7 @@ describe('ReactDOMInput', () => {
53 it('should warn for controlled value of 0 with missing onChange', () => {
54 expect(() => {
55 ReactDOM.render(<input type="text" value={0} />, container);
56 - }).toWarnDev(
56 + }).toErrorDev(
57 'Failed prop type: You provided a `value` prop to a form field without an `onChange` handler.',
58 );
59 });
@@ -61,7 +61,7 @@ describe('ReactDOMInput', () => {
61 it('should warn for controlled value of "" with missing onChange', () => {
62 expect(() => {
63 ReactDOM.render(<input type="text" value="" />, container);
64 - }).toWarnDev(
64 + }).toErrorDev(
65 'Failed prop type: You provided a `value` prop to a form field without an `onChange` handler.',
66 );
67 });
@@ -69,7 +69,7 @@ describe('ReactDOMInput', () => {
69 it('should warn for controlled value of "0" with missing onChange', () => {
70 expect(() => {
71 ReactDOM.render(<input type="text" value="0" />, container);
72 - }).toWarnDev(
72 + }).toErrorDev(
73 'Failed prop type: You provided a `value` prop to a form field without an `onChange` handler.',
74 );
75 });
@@ -77,7 +77,7 @@ describe('ReactDOMInput', () => {
77 it('should warn for controlled value of false with missing onChange', () => {
78 expect(() =>
79 ReactDOM.render(<input type="checkbox" checked={false} />, container),
80 - ).toWarnDev(
80 + ).toErrorDev(
81 'Failed prop type: You provided a `checked` prop to a form field without an `onChange` handler.',
82 );
83 });
@@ -94,7 +94,7 @@ describe('ReactDOMInput', () => {
94 <input type="checkbox" checked={false} readOnly={false} />,
95 container,
96 ),
97 - ).toWarnDev(
97 + ).toErrorDev(
98 'Failed prop type: You provided a `checked` prop to a form field without an `onChange` handler. ' +
99 'This will render a read-only field. If the field should be mutable use `defaultChecked`. ' +
100 'Otherwise, set either `onChange` or `readOnly`.',
@@ -120,7 +120,7 @@ describe('ReactDOMInput', () => {
120
121 expect(() => {
122 node = ReactDOM.render(<input type="text" value="lion" />, container);
123 - }).toWarnDev(
123 + }).toErrorDev(
124 'Failed prop type: You provided a `value` prop to a form field without an `onChange` handler.',
125 );
126
@@ -301,7 +301,7 @@ describe('ReactDOMInput', () => {
301 let stub;
302 expect(() => {
303 stub = ReactDOM.render(<Stub />, container);
304 - }).toWarnDev(
304 + }).toErrorDev(
305 'You provided a `value` prop to a form field ' +
306 'without an `onChange` handler.',
307 );
@@ -368,7 +368,7 @@ describe('ReactDOMInput', () => {
368
369 expect(() => {
370 stub = ReactDOM.render(<Stub />, container);
371 - }).toWarnDev(
371 + }).toErrorDev(
372 'You provided a `value` prop to a form field ' +
373 'without an `onChange` handler.',
374 );
@@ -474,7 +474,7 @@ describe('ReactDOMInput', () => {
474 expect(node.value).toBe('0');
475 expect(() =>
476 ReactDOM.render(<input type="text" defaultValue="1" />, container),
477 - ).toWarnDev(
477 + ).toErrorDev(
478 'A component is changing a controlled input of type ' +
479 'text to be uncontrolled.',
480 );
@@ -853,7 +853,7 @@ describe('ReactDOMInput', () => {
853 <input type="submit" value={undefined} onChange={emptyFunction} />,
854 container,
855 ),
856 - ).toWarnDev(
856 + ).toErrorDev(
857 'A component is changing a controlled input of type ' +
858 'submit to be uncontrolled.',
859 );
@@ -873,7 +873,7 @@ describe('ReactDOMInput', () => {
873 <input type="reset" value={undefined} onChange={emptyFunction} />,
874 container,
875 ),
876 - ).toWarnDev(
876 + ).toErrorDev(
877 'A component is changing a controlled input of type ' +
878 'reset to be uncontrolled.',
879 );
@@ -920,7 +920,7 @@ describe('ReactDOMInput', () => {
920 let stub = <input type="submit" value={null} />;
921 expect(() => {
922 ReactDOM.render(stub, container);
923 - }).toWarnDev('`value` prop on `input` should not be null');
923 + }).toErrorDev('`value` prop on `input` should not be null');
924 const node = container.firstChild;
925
926 // Note: it shouldn't be an empty string
@@ -935,7 +935,7 @@ describe('ReactDOMInput', () => {
935 let stub = <input type="reset" value={null} />;
936 expect(() => {
937 ReactDOM.render(stub, container);
938 - }).toWarnDev('`value` prop on `input` should not be null');
938 + }).toErrorDev('`value` prop on `input` should not be null');
939 const node = container.firstChild;
940
941 // Note: it shouldn't be an empty string
@@ -1167,7 +1167,7 @@ describe('ReactDOMInput', () => {
1167 <input type="text" value="zoink" readOnly={false} />,
1168 container,
1169 ),
1170 - ).toWarnDev(
1170 + ).toErrorDev(
1171 'Warning: Failed prop type: You provided a `value` prop to a form ' +
1172 'field without an `onChange` handler. This will render a read-only ' +
1173 'field. If the field should be mutable use `defaultValue`. ' +
@@ -1198,7 +1198,7 @@ describe('ReactDOMInput', () => {
1198 it('should warn if value is null', () => {
1199 expect(() =>
1200 ReactDOM.render(<input type="text" value={null} />, container),
1201 - ).toWarnDev(
1201 + ).toErrorDev(
1202 '`value` prop on `input` should not be null. ' +
1203 'Consider using an empty string to clear the component or `undefined` ' +
1204 'for uncontrolled components.',
@@ -1219,7 +1219,7 @@ describe('ReactDOMInput', () => {
1219 />,
1220 container,
1221 ),
1222 - ).toWarnDev(
1222 + ).toErrorDev(
1223 'A component contains an input of type radio with both checked and defaultChecked props. ' +
1224 'Input elements must be either controlled or uncontrolled ' +
1225 '(specify either the checked prop, or the defaultChecked prop, but not ' +
@@ -1246,7 +1246,7 @@ describe('ReactDOMInput', () => {
1246 <input type="text" value="foo" defaultValue="bar" readOnly={true} />,
1247 container,
1248 ),
1249 - ).toWarnDev(
1249 + ).toErrorDev(
1250 'A component contains an input of type text with both value and defaultValue props. ' +
1251 'Input elements must be either controlled or uncontrolled ' +
1252 '(specify either the value prop, or the defaultValue prop, but not ' +
@@ -1267,7 +1267,7 @@ describe('ReactDOMInput', () => {
1267 <input type="text" value="controlled" onChange={emptyFunction} />
1268 );
1269 ReactDOM.render(stub, container);
1270 - expect(() => ReactDOM.render(<input type="text" />, container)).toWarnDev(
1270 + expect(() => ReactDOM.render(<input type="text" />, container)).toErrorDev(
1271 'Warning: A component is changing a controlled input of type text to be uncontrolled. ' +
1272 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1273 'Decide between using a controlled or uncontrolled input ' +
@@ -1283,7 +1283,7 @@ describe('ReactDOMInput', () => {
1283 ReactDOM.render(stub, container);
1284 expect(() =>
1285 ReactDOM.render(<input type="text" value={null} />, container),
1286 - ).toWarnDev([
1286 + ).toErrorDev([
1287 '`value` prop on `input` should not be null. ' +
1288 'Consider using an empty string to clear the component or `undefined` for uncontrolled components',
1289 'Warning: A component is changing a controlled input of type text to be uncontrolled. ' +
@@ -1304,7 +1304,7 @@ describe('ReactDOMInput', () => {
1304 <input type="text" defaultValue="uncontrolled" />,
1305 container,
1306 ),
1307 - ).toWarnDev(
1307 + ).toErrorDev(
1308 'Warning: A component is changing a controlled input of type text to be uncontrolled. ' +
1309 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1310 'Decide between using a controlled or uncontrolled input ' +
@@ -1318,7 +1318,7 @@ describe('ReactDOMInput', () => {
1318 ReactDOM.render(stub, container);
1319 expect(() =>
1320 ReactDOM.render(<input type="text" value="controlled" />, container),
1321 - ).toWarnDev(
1321 + ).toErrorDev(
1322 'Warning: A component is changing an uncontrolled input of type text to be controlled. ' +
1323 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1324 'Decide between using a controlled or uncontrolled input ' +
@@ -1329,13 +1329,13 @@ describe('ReactDOMInput', () => {
1329
1330 it('should warn if uncontrolled input (value is null) switches to controlled', () => {
1331 const stub = <input type="text" value={null} />;
1332 - expect(() => ReactDOM.render(stub, container)).toWarnDev(
1332 + expect(() => ReactDOM.render(stub, container)).toErrorDev(
1333 '`value` prop on `input` should not be null. ' +
1334 'Consider using an empty string to clear the component or `undefined` for uncontrolled components.',
1335 );
1336 expect(() =>
1337 ReactDOM.render(<input type="text" value="controlled" />, container),
1338 - ).toWarnDev(
1338 + ).toErrorDev(
1339 'Warning: A component is changing an uncontrolled input of type text to be controlled. ' +
1340 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1341 'Decide between using a controlled or uncontrolled input ' +
@@ -1351,7 +1351,7 @@ describe('ReactDOMInput', () => {
1351 ReactDOM.render(stub, container);
1352 expect(() =>
1353 ReactDOM.render(<input type="checkbox" />, container),
1354 - ).toWarnDev(
1354 + ).toErrorDev(
1355 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled. ' +
1356 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1357 'Decide between using a controlled or uncontrolled input ' +
@@ -1367,7 +1367,7 @@ describe('ReactDOMInput', () => {
1367 ReactDOM.render(stub, container);
1368 expect(() =>
1369 ReactDOM.render(<input type="checkbox" checked={null} />, container),
1370 - ).toWarnDev(
1370 + ).toErrorDev(
1371 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled. ' +
1372 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1373 'Decide between using a controlled or uncontrolled input ' +
@@ -1386,7 +1386,7 @@ describe('ReactDOMInput', () => {
1386 <input type="checkbox" defaultChecked={true} />,
1387 container,
1388 ),
1389 - ).toWarnDev(
1389 + ).toErrorDev(
1390 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled. ' +
1391 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1392 'Decide between using a controlled or uncontrolled input ' +
@@ -1400,7 +1400,7 @@ describe('ReactDOMInput', () => {
1400 ReactDOM.render(stub, container);
1401 expect(() =>
1402 ReactDOM.render(<input type="checkbox" checked={true} />, container),
1403 - ).toWarnDev(
1403 + ).toErrorDev(
1404 'Warning: A component is changing an uncontrolled input of type checkbox to be controlled. ' +
1405 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1406 'Decide between using a controlled or uncontrolled input ' +
@@ -1414,7 +1414,7 @@ describe('ReactDOMInput', () => {
1414 ReactDOM.render(stub, container);
1415 expect(() =>
1416 ReactDOM.render(<input type="checkbox" checked={true} />, container),
1417 - ).toWarnDev(
1417 + ).toErrorDev(
1418 'Warning: A component is changing an uncontrolled input of type checkbox to be controlled. ' +
1419 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1420 'Decide between using a controlled or uncontrolled input ' +
@@ -1426,7 +1426,7 @@ describe('ReactDOMInput', () => {
1426 it('should warn if controlled radio switches to uncontrolled (checked is undefined)', () => {
1427 const stub = <input type="radio" checked={true} onChange={emptyFunction} />;
1428 ReactDOM.render(stub, container);
1429 - expect(() => ReactDOM.render(<input type="radio" />, container)).toWarnDev(
1429 + expect(() => ReactDOM.render(<input type="radio" />, container)).toErrorDev(
1430 'Warning: A component is changing a controlled input of type radio to be uncontrolled. ' +
1431 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1432 'Decide between using a controlled or uncontrolled input ' +
@@ -1440,7 +1440,7 @@ describe('ReactDOMInput', () => {
1440 ReactDOM.render(stub, container);
1441 expect(() =>
1442 ReactDOM.render(<input type="radio" checked={null} />, container),
1443 - ).toWarnDev(
1443 + ).toErrorDev(
1444 'Warning: A component is changing a controlled input of type radio to be uncontrolled. ' +
1445 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1446 'Decide between using a controlled or uncontrolled input ' +
@@ -1454,7 +1454,7 @@ describe('ReactDOMInput', () => {
1454 ReactDOM.render(stub, container);
1455 expect(() =>
1456 ReactDOM.render(<input type="radio" defaultChecked={true} />, container),
1457 - ).toWarnDev(
1457 + ).toErrorDev(
1458 'Warning: A component is changing a controlled input of type radio to be uncontrolled. ' +
1459 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1460 'Decide between using a controlled or uncontrolled input ' +
@@ -1468,7 +1468,7 @@ describe('ReactDOMInput', () => {
1468 ReactDOM.render(stub, container);
1469 expect(() =>
1470 ReactDOM.render(<input type="radio" checked={true} />, container),
1471 - ).toWarnDev(
1471 + ).toErrorDev(
1472 'Warning: A component is changing an uncontrolled input of type radio to be controlled. ' +
1473 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1474 'Decide between using a controlled or uncontrolled input ' +
@@ -1482,7 +1482,7 @@ describe('ReactDOMInput', () => {
1482 ReactDOM.render(stub, container);
1483 expect(() =>
1484 ReactDOM.render(<input type="radio" checked={true} />, container),
1485 - ).toWarnDev(
1485 + ).toErrorDev(
1486 'Warning: A component is changing an uncontrolled input of type radio to be controlled. ' +
1487 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' +
1488 'Decide between using a controlled or uncontrolled input ' +
@@ -1534,7 +1534,7 @@ describe('ReactDOMInput', () => {
1534 );
1535 expect(() =>
1536 ReactDOM.render(<input type="radio" value="value" />, container),
1537 - ).toWarnDev(
1537 + ).toErrorDev(
1538 'Warning: A component is changing a controlled input of type radio to be uncontrolled. ' +
1539 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' +
1540 'Decide between using a controlled or uncontrolled input ' +
@@ -1816,7 +1816,7 @@ describe('ReactDOMInput', () => {
1816 }
1817
1818 it('reverts the value attribute to the initial value', () => {
1819 - expect(renderInputWithStringThenWithUndefined).toWarnDev(
1819 + expect(renderInputWithStringThenWithUndefined).toErrorDev(
1820 'Input elements should not switch from controlled to ' +
1821 'uncontrolled (or vice versa).',
1822 );
@@ -1828,7 +1828,7 @@ describe('ReactDOMInput', () => {
1828 });
1829
1830 it('preserves the value property', () => {
1831 - expect(renderInputWithStringThenWithUndefined).toWarnDev(
1831 + expect(renderInputWithStringThenWithUndefined).toErrorDev(
1832 'Input elements should not switch from controlled to ' +
1833 'uncontrolled (or vice versa).',
1834 );
@@ -1865,7 +1865,7 @@ describe('ReactDOMInput', () => {
1865 }
1866
1867 it('reverts the value attribute to the initial value', () => {
1868 - expect(renderInputWithStringThenWithNull).toWarnDev([
1868 + expect(renderInputWithStringThenWithNull).toErrorDev([
1869 '`value` prop on `input` should not be null. ' +
1870 'Consider using an empty string to clear the component ' +
1871 'or `undefined` for uncontrolled components.',
@@ -1880,7 +1880,7 @@ describe('ReactDOMInput', () => {
1880 });
1881
1882 it('preserves the value property', () => {
1883 - expect(renderInputWithStringThenWithNull).toWarnDev([
1883 + expect(renderInputWithStringThenWithNull).toErrorDev([
1884 '`value` prop on `input` should not be null. ' +
1885 'Consider using an empty string to clear the component ' +
1886 'or `undefined` for uncontrolled components.',
@@ -1898,7 +1898,7 @@ describe('ReactDOMInput', () => {
1898 <input value={Symbol('foobar')} onChange={() => {}} />,
1899 container,
1900 ),
1901 - ).toWarnDev('Invalid value for prop `value`');
1901 + ).toErrorDev('Invalid value for prop `value`');
1902 const node = container.firstChild;
1903
1904 expect(node.value).toBe('');
@@ -1916,7 +1916,7 @@ describe('ReactDOMInput', () => {
1916 <input value={Symbol('foobar')} onChange={() => {}} />,
1917 container,
1918 ),
1919 - ).toWarnDev('Invalid value for prop `value`');
1919 + ).toErrorDev('Invalid value for prop `value`');
1920 const node = container.firstChild;
1921
1922 expect(node.value).toBe('');
@@ -1958,7 +1958,7 @@ describe('ReactDOMInput', () => {
1958 <input value={() => {}} onChange={() => {}} />,
1959 container,
1960 ),
1961 - ).toWarnDev('Invalid value for prop `value`');
1961 + ).toErrorDev('Invalid value for prop `value`');
1962 const node = container.firstChild;
1963
1964 expect(node.value).toBe('');
@@ -1976,7 +1976,7 @@ describe('ReactDOMInput', () => {
1976 <input value={() => {}} onChange={() => {}} />,
1977 container,
1978 ),
1979 - ).toWarnDev('Invalid value for prop `value`');
1979 + ).toErrorDev('Invalid value for prop `value`');
1980 const node = container.firstChild;
1981
1982 expect(node.value).toBe('');
packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js
+5 -5
@@ -29,7 +29,7 @@ describe('ReactDOMInvalidARIAHook', () => {
29 mountComponent({'aria-label': 'Bumble bees'});
30 });
31 it('should warn for one invalid aria-* prop', () => {
32 - expect(() => mountComponent({'aria-badprop': 'maybe'})).toWarnDev(
32 + expect(() => mountComponent({'aria-badprop': 'maybe'})).toErrorDev(
33 'Warning: Invalid aria prop `aria-badprop` on <div> tag. ' +
34 'For details, see https://fb.me/invalid-aria-prop',
35 );
@@ -40,14 +40,14 @@ describe('ReactDOMInvalidARIAHook', () => {
40 'aria-badprop': 'Very tall trees',
41 'aria-malprop': 'Turbulent seas',
42 }),
43 - ).toWarnDev(
43 + ).toErrorDev(
44 'Warning: Invalid aria props `aria-badprop`, `aria-malprop` on <div> ' +
45 'tag. For details, see https://fb.me/invalid-aria-prop',
46 );
47 });
48 it('should warn for an improperly cased aria-* prop', () => {
49 // The valid attribute name is aria-haspopup.
50 - expect(() => mountComponent({'aria-hasPopup': 'true'})).toWarnDev(
50 + expect(() => mountComponent({'aria-hasPopup': 'true'})).toErrorDev(
51 'Warning: Unknown ARIA attribute `aria-hasPopup`. ' +
52 'Did you mean `aria-haspopup`?',
53 );
@@ -55,7 +55,7 @@ describe('ReactDOMInvalidARIAHook', () => {
55
56 it('should warn for use of recognized camel case aria attributes', () => {
57 // The valid attribute name is aria-haspopup.
58 - expect(() => mountComponent({ariaHasPopup: 'true'})).toWarnDev(
58 + expect(() => mountComponent({ariaHasPopup: 'true'})).toErrorDev(
59 'Warning: Invalid ARIA attribute `ariaHasPopup`. ' +
60 'Did you mean `aria-haspopup`?',
61 );
@@ -63,7 +63,7 @@ describe('ReactDOMInvalidARIAHook', () => {
63
64 it('should warn for use of unrecognized camel case aria attributes', () => {
65 // The valid attribute name is aria-haspopup.
66 - expect(() => mountComponent({ariaSomethingInvalid: 'true'})).toWarnDev(
66 + expect(() => mountComponent({ariaSomethingInvalid: 'true'})).toErrorDev(
67 'Warning: Invalid ARIA attribute `ariaSomethingInvalid`. ARIA ' +
68 'attributes follow the pattern aria-* and must be lowercase.',
69 );
packages/react-dom/src/__tests__/ReactDOMOption-test.js
+2 -2
@@ -41,7 +41,7 @@ describe('ReactDOMOption', () => {
41 let node;
42 expect(() => {
43 node = ReactTestUtils.renderIntoDocument(el);
44 - }).toWarnDev(
44 + }).toErrorDev(
45 'Only strings and numbers are supported as <option> children.\n' +
46 ' in option (at **)',
47 );
@@ -118,7 +118,7 @@ describe('ReactDOMOption', () => {
118 <span />
119 </option>,
120 );
121 - }).toWarnDev(
121 + }).toErrorDev(
122 'Only strings and numbers are supported as <option> children.',
123 );
124 expect(node.innerHTML).toBe('hello[object Object]');
packages/react-dom/src/__tests__/ReactDOMRoot-test.js
+7 -7
@@ -81,7 +81,7 @@ describe('ReactDOMRoot', () => {
81 <span />
82 </div>,
83 );
84 - expect(() => Scheduler.unstable_flushAll()).toWarnDev('Extra attributes');
84 + expect(() => Scheduler.unstable_flushAll()).toErrorDev('Extra attributes');
85 });
86
87 it('does not clear existing children', async () => {
@@ -118,7 +118,7 @@ describe('ReactDOMRoot', () => {
118 expect(container.textContent).toEqual('Hi');
119 expect(() => {
120 ReactDOM.render(<div>Bye</div>, container);
121 - }).toWarnDev(
121 + }).toErrorDev(
122 [
123 // We care about this warning:
124 'You are calling ReactDOM.render() on a container that was previously ' +
@@ -141,7 +141,7 @@ describe('ReactDOMRoot', () => {
141 expect(container.textContent).toEqual('Hi');
142 expect(() => {
143 ReactDOM.hydrate(<div>Hi</div>, container);
144 - }).toWarnDev(
144 + }).toErrorDev(
145 [
146 // We care about this warning:
147 'You are calling ReactDOM.hydrate() on a container that was previously ' +
@@ -162,7 +162,7 @@ describe('ReactDOMRoot', () => {
162 let unmounted = false;
163 expect(() => {
164 unmounted = ReactDOM.unmountComponentAtNode(container);
165 - }).toWarnDev(
165 + }).toErrorDev(
166 [
167 // We care about this warning:
168 'You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' +
@@ -191,7 +191,7 @@ describe('ReactDOMRoot', () => {
191 let unmounted = false;
192 expect(() => {
193 unmounted = ReactDOM.unmountComponentAtNode(container);
194 - }).toWarnDev('Did you mean to call root.unmount()?', {withoutStack: true});
194 + }).toErrorDev('Did you mean to call root.unmount()?', {withoutStack: true});
195 expect(unmounted).toBe(false);
196 Scheduler.unstable_flushAll();
197 expect(container.textContent).toEqual('Hi');
@@ -204,7 +204,7 @@ describe('ReactDOMRoot', () => {
204 ReactDOM.render(<div>Hi</div>, container);
205 expect(() => {
206 ReactDOM.createRoot(container);
207 - }).toWarnDev(
207 + }).toErrorDev(
208 'You are calling ReactDOM.createRoot() on a container that was previously ' +
209 'passed to ReactDOM.render(). This is not supported.',
210 {withoutStack: true},
@@ -215,7 +215,7 @@ describe('ReactDOMRoot', () => {
215 ReactDOM.createRoot(container);
216 expect(() => {
217 ReactDOM.createRoot(container);
218 - }).toWarnDev(
218 + }).toErrorDev(
219 'You are calling ReactDOM.createRoot() on a container that ' +
220 'has already been passed to createRoot() before. Instead, call ' +
221 'root.render() on the existing root instead if you want to update it.',
packages/react-dom/src/__tests__/ReactDOMSelect-test.js
+12 -12
@@ -610,7 +610,7 @@ describe('ReactDOMSelect', () => {
610 <option value="test" />
611 </select>,
612 ),
613 - ).toWarnDev(
613 + ).toErrorDev(
614 '`value` prop on `select` should not be null. ' +
615 'Consider using an empty string to clear the component or `undefined` ' +
616 'for uncontrolled components.',
@@ -633,7 +633,7 @@ describe('ReactDOMSelect', () => {
633 );
634 }
635
636 - expect(() => ReactTestUtils.renderIntoDocument(<App />)).toWarnDev(
636 + expect(() => ReactTestUtils.renderIntoDocument(<App />)).toErrorDev(
637 'Use the `defaultValue` or `value` props on <select> instead of ' +
638 'setting `selected` on <option>.',
639 );
@@ -648,7 +648,7 @@ describe('ReactDOMSelect', () => {
648 <option value="test" />
649 </select>,
650 ),
651 - ).toWarnDev(
651 + ).toErrorDev(
652 '`value` prop on `select` should not be null. ' +
653 'Consider using an empty array when `multiple` is ' +
654 'set to `true` to clear the component or `undefined` ' +
@@ -695,7 +695,7 @@ describe('ReactDOMSelect', () => {
695 <option value="gorilla">A gorilla!</option>
696 </select>,
697 ),
698 - ).toWarnDev(
698 + ).toErrorDev(
699 'Select elements must be either controlled or uncontrolled ' +
700 '(specify either the value prop, or the defaultValue prop, but not ' +
701 'both). Decide between using a controlled or uncontrolled select ' +
@@ -847,7 +847,7 @@ describe('ReactDOMSelect', () => {
847 <option value="giraffe">A giraffe!</option>
848 </select>,
849 );
850 - }).toWarnDev('Invalid value for prop `value`');
850 + }).toErrorDev('Invalid value for prop `value`');
851
852 expect(node.value).toBe('');
853 });
@@ -863,7 +863,7 @@ describe('ReactDOMSelect', () => {
863 <option value="giraffe">A giraffe!</option>
864 </select>,
865 );
866 - }).toWarnDev('Invalid value for prop `value`');
866 + }).toErrorDev('Invalid value for prop `value`');
867
868 expect(node.value).toBe('monkey');
869
@@ -889,7 +889,7 @@ describe('ReactDOMSelect', () => {
889 <option value="giraffe">A giraffe!</option>
890 </select>,
891 );
892 - }).toWarnDev('Invalid value for prop `value`');
892 + }).toErrorDev('Invalid value for prop `value`');
893
894 expect(node.value).toBe('');
895 });
@@ -905,7 +905,7 @@ describe('ReactDOMSelect', () => {
905 <option value="giraffe">A giraffe!</option>
906 </select>,
907 );
908 - }).toWarnDev('Invalid value for prop `value`');
908 + }).toErrorDev('Invalid value for prop `value`');
909
910 expect(node.value).toBe('monkey');
911
@@ -933,7 +933,7 @@ describe('ReactDOMSelect', () => {
933 <option value="giraffe">A giraffe!</option>
934 </select>,
935 );
936 - }).toWarnDev('Invalid value for prop `value`');
936 + }).toErrorDev('Invalid value for prop `value`');
937
938 expect(node.value).toBe('');
939 });
@@ -949,7 +949,7 @@ describe('ReactDOMSelect', () => {
949 <option value="giraffe">A giraffe!</option>
950 </select>,
951 );
952 - }).toWarnDev('Invalid value for prop `value`');
952 + }).toErrorDev('Invalid value for prop `value`');
953
954 expect(node.value).toBe('');
955 });
@@ -965,7 +965,7 @@ describe('ReactDOMSelect', () => {
965 <option value="giraffe">A giraffe!</option>
966 </select>,
967 );
968 - }).toWarnDev('Invalid value for prop `value`');
968 + }).toErrorDev('Invalid value for prop `value`');
969
970 expect(node.value).toBe('monkey');
971
@@ -991,7 +991,7 @@ describe('ReactDOMSelect', () => {
991 <option value="giraffe">A giraffe!</option>
992 </select>,
993 );
994 - }).toWarnDev('Invalid value for prop `value`');
994 + }).toErrorDev('Invalid value for prop `value`');
995
996 expect(node.value).toBe('monkey');
997
packages/react-dom/src/__tests__/ReactDOMServerIntegrationAttributes-test.js
+1 -1
@@ -606,7 +606,7 @@ describe('ReactDOMServerIntegration', () => {
606 // so that it gets deduplicated later, and doesn't fail the test.
607 expect(() => {
608 ReactDOM.render(<nonstandard />, document.createElement('div'));
609 - }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.');
609 + }).toErrorDev('The tag <nonstandard> is unrecognized in this browser.');
610
611 const e = await render(<nonstandard foo="bar" />);
612 expect(e.getAttribute('foo')).toBe('bar');
packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js
+4 -4
@@ -146,7 +146,7 @@ describe('ReactDOMServerIntegration', () => {
146 // so that it gets deduplicated later, and doesn't fail the test.
147 expect(() => {
148 ReactDOM.render(<nonstandard />, document.createElement('div'));
149 - }).toWarnDev('The tag <nonstandard> is unrecognized in this browser.');
149 + }).toErrorDev('The tag <nonstandard> is unrecognized in this browser.');
150
151 const e = await render(<nonstandard>Text</nonstandard>);
152 expect(e.tagName).toBe('NONSTANDARD');
@@ -982,7 +982,7 @@ describe('ReactDOMServerIntegration', () => {
982 let EmptyComponent = {};
983 expect(() => {
984 EmptyComponent = <EmptyComponent />;
985 - }).toWarnDev(
985 + }).toErrorDev(
986 'Warning: React.createElement: type is invalid -- expected a string ' +
987 '(for built-in components) or a class/function (for composite ' +
988 'components) but got: object. You likely forgot to export your ' +
@@ -1006,7 +1006,7 @@ describe('ReactDOMServerIntegration', () => {
1006 let NullComponent = null;
1007 expect(() => {
1008 NullComponent = <NullComponent />;
1009 - }).toWarnDev(
1009 + }).toErrorDev(
1010 'Warning: React.createElement: type is invalid -- expected a string ' +
1011 '(for built-in components) or a class/function (for composite ' +
1012 'components) but got: null.',
@@ -1024,7 +1024,7 @@ describe('ReactDOMServerIntegration', () => {
1024 let UndefinedComponent = undefined;
1025 expect(() => {
1026 UndefinedComponent = <UndefinedComponent />;
1027 - }).toWarnDev(
1027 + }).toErrorDev(
1028 'Warning: React.createElement: type is invalid -- expected a string ' +
1029 '(for built-in components) or a class/function (for composite ' +
1030 'components) but got: undefined. You likely forgot to export your ' +
packages/react-dom/src/__tests__/ReactDOMServerIntegrationUntrustedURL-test.internal.js
+1 -1
@@ -170,7 +170,7 @@ describe('ReactDOMServerIntegration - Untrusted URLs', () => {
170 });
171
172 runTests(itRenders, itRenders, fn =>
173 - expect(fn).toWarnDev(
173 + expect(fn).toErrorDev(
174 'Warning: A future version of React will block javascript: URLs as a security precaution. ' +
175 'Use event handlers instead if you can. If you need to generate unsafe HTML try using ' +
176 'dangerouslySetInnerHTML instead. React was passed "javascript:notfine".\n' +
packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js
+12 -12
@@ -180,7 +180,7 @@ describe('ReactDOMServerLifecycles', () => {
180 }
181 }
182
183 - expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
183 + expect(() => ReactDOMServer.renderToString(<Component />)).toErrorDev(
184 'Component.getDerivedStateFromProps(): A valid state object (or null) must ' +
185 'be returned. You have returned undefined.',
186 );
@@ -199,7 +199,7 @@ describe('ReactDOMServerLifecycles', () => {
199 }
200 }
201
202 - expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
202 + expect(() => ReactDOMServer.renderToString(<Component />)).toErrorDev(
203 '`Component` uses `getDerivedStateFromProps` but its initial state is ' +
204 'undefined. This is not recommended. Instead, define the initial state by ' +
205 'assigning an object to `this.state` in the constructor of `Component`. ' +
@@ -225,9 +225,9 @@ describe('ReactDOMServerLifecycles', () => {
225 }
226 }
227
228 - expect(() =>
229 - ReactDOMServer.renderToString(<Component />),
230 - ).toLowPriorityWarnDev('componentWillMount has been renamed');
228 + expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
229 + 'componentWillMount has been renamed',
230 + );
231 expect(log).toEqual(['componentWillMount', 'UNSAFE_componentWillMount']);
232 });
233
@@ -257,7 +257,7 @@ describe('ReactDOMServerLifecycles', () => {
257 expect(ReactDOMServer.renderToStaticMarkup(<Outer />)).toBe(
258 '<div>1-2</div>',
259 );
260 - }).toWarnDev(
260 + }).toErrorDev(
261 'Warning: setState(...): Can only update a mounting component. This ' +
262 'usually means you called setState() outside componentWillMount() on ' +
263 'the server. This is a no-op.\n\n' +
@@ -279,9 +279,9 @@ describe('ReactDOMServerLifecycles', () => {
279 }
280 }
281
282 - expect(() =>
283 - ReactDOMServer.renderToString(<Component />),
284 - ).toLowPriorityWarnDev('componentWillMount has been renamed');
282 + expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
283 + 'componentWillMount has been renamed',
284 + );
285 });
286
287 it('should warn about deprecated lifecycle hooks', () => {
@@ -292,9 +292,9 @@ describe('ReactDOMServerLifecycles', () => {
292 }
293 }
294
295 - expect(() =>
296 - ReactDOMServer.renderToString(<Component />),
297 - ).toLowPriorityWarnDev('componentWillMount has been renamed');
295 + expect(() => ReactDOMServer.renderToString(<Component />)).toWarnDev(
296 + 'componentWillMount has been renamed',
297 + );
298
299 // De-duped
300 ReactDOMServer.renderToString(<Component />);
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
+1 -1
@@ -341,7 +341,7 @@ describe('ReactDOMServerPartialHydration', () => {
341 act(() => {
342 ReactDOM.hydrate(<App />, container);
343 });
344 - }).toWarnDev(
344 + }).toErrorDev(
345 'Warning: Cannot hydrate Suspense in legacy mode. Switch from ' +
346 'ReactDOM.hydrate(element, container) to ' +
347 'ReactDOM.createBlockingRoot(container, { hydrate: true })' +
packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.internal.js
+8 -8
@@ -27,7 +27,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
27 ReactDOM.render(<div style={{font: 'foo', fontStyle: 'bar'}} />, container);
28 expect(() =>
29 ReactDOM.render(<div style={{font: 'foo'}} />, container),
30 - ).toWarnDev(
30 + ).toErrorDev(
31 'Warning: Removing a style property during rerender (fontStyle) ' +
32 'when a conflicting property is set (font) can lead to styling ' +
33 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
@@ -45,7 +45,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
45 <div style={{font: 'qux', fontStyle: 'baz'}} />,
46 container,
47 ),
48 - ).toWarnDev(
48 + ).toErrorDev(
49 'Warning: Updating a style property during rerender (font) when ' +
50 'a conflicting property is set (fontStyle) can lead to styling ' +
51 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
@@ -55,7 +55,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
55 );
56 expect(() =>
57 ReactDOM.render(<div style={{fontStyle: 'baz'}} />, container),
58 - ).toWarnDev(
58 + ).toErrorDev(
59 'Warning: Removing a style property during rerender (font) when ' +
60 'a conflicting property is set (fontStyle) can lead to styling ' +
61 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
@@ -72,7 +72,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
72 );
73 expect(() =>
74 ReactDOM.render(<div style={{background: 'yellow'}} />, container),
75 - ).toWarnDev(
75 + ).toErrorDev(
76 'Warning: Removing a style property during rerender ' +
77 '(backgroundPosition) when a conflicting property is set ' +
78 "(background) can lead to styling bugs. To avoid this, don't mix " +
@@ -91,7 +91,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
91 );
92 expect(() =>
93 ReactDOM.render(<div style={{backgroundPosition: 'top'}} />, container),
94 - ).toWarnDev(
94 + ).toErrorDev(
95 'Warning: Removing a style property during rerender (background) ' +
96 'when a conflicting property is set (backgroundPosition) can lead ' +
97 "to styling bugs. To avoid this, don't mix shorthand and " +
@@ -107,7 +107,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
107 );
108 expect(() =>
109 ReactDOM.render(<div style={{borderLeft: '1px solid red'}} />, container),
110 - ).toWarnDev(
110 + ).toErrorDev(
111 'Warning: Removing a style property during rerender (borderStyle) ' +
112 'when a conflicting property is set (borderLeft) can lead to ' +
113 "styling bugs. To avoid this, don't mix shorthand and " +
@@ -120,7 +120,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
120 <div style={{borderStyle: 'dashed', borderLeft: '1px solid red'}} />,
121 container,
122 ),
123 - ).toWarnDev(
123 + ).toErrorDev(
124 'Warning: Updating a style property during rerender (borderStyle) ' +
125 'when a conflicting property is set (borderLeft) can lead to ' +
126 "styling bugs. To avoid this, don't mix shorthand and " +
@@ -135,7 +135,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
135 );
136 expect(() =>
137 ReactDOM.render(<div style={{borderStyle: 'dotted'}} />, container),
138 - ).toWarnDev(
138 + ).toErrorDev(
139 'Warning: Removing a style property during rerender (borderLeft) ' +
140 'when a conflicting property is set (borderStyle) can lead to ' +
141 "styling bugs. To avoid this, don't mix shorthand and " +
packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
+14 -14
@@ -294,7 +294,7 @@ describe('ReactDOMTextarea', () => {
294
295 expect(() => {
296 node = renderTextarea(stub, container);
297 - }).toWarnDev(
297 + }).toErrorDev(
298 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
299 );
300
@@ -346,7 +346,7 @@ describe('ReactDOMTextarea', () => {
346 let node;
347 expect(() => {
348 node = renderTextarea(<textarea>{17}</textarea>);
349 - }).toWarnDev(
349 + }).toErrorDev(
350 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
351 );
352 expect(node.value).toBe('17');
@@ -356,7 +356,7 @@ describe('ReactDOMTextarea', () => {
356 let node;
357 expect(() => {
358 node = renderTextarea(<textarea>{false}</textarea>);
359 - }).toWarnDev(
359 + }).toErrorDev(
360 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
361 );
362 expect(node.value).toBe('false');
@@ -371,7 +371,7 @@ describe('ReactDOMTextarea', () => {
371 let node;
372 expect(() => {
373 node = renderTextarea(<textarea>{obj}</textarea>);
374 - }).toWarnDev(
374 + }).toErrorDev(
375 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
376 );
377 expect(node.value).toBe('sharkswithlasers');
@@ -387,7 +387,7 @@ describe('ReactDOMTextarea', () => {
387 </textarea>,
388 ),
389 ).toThrow('<textarea> can only have at most one child');
390 - }).toWarnDev(
390 + }).toErrorDev(
391 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
392 );
393
@@ -401,7 +401,7 @@ describe('ReactDOMTextarea', () => {
401 </textarea>,
402 )),
403 ).not.toThrow();
404 - }).toWarnDev(
404 + }).toErrorDev(
405 'Use the `defaultValue` or `value` props instead of setting children on <textarea>.',
406 );
407
@@ -417,7 +417,7 @@ describe('ReactDOMTextarea', () => {
417 it('should warn if value is null', () => {
418 expect(() =>
419 ReactTestUtils.renderIntoDocument(<textarea value={null} />),
420 - ).toWarnDev(
420 + ).toErrorDev(
421 '`value` prop on `textarea` should not be null. ' +
422 'Consider using an empty string to clear the component or `undefined` ' +
423 'for uncontrolled components.',
@@ -433,7 +433,7 @@ describe('ReactDOMTextarea', () => {
433 );
434 expect(() =>
435 ReactTestUtils.renderIntoDocument(<InvalidComponent />),
436 - ).toWarnDev(
436 + ).toErrorDev(
437 'InvalidComponent contains a textarea with both value and defaultValue props. ' +
438 'Textarea elements must be either controlled or uncontrolled ' +
439 '(specify either the value prop, or the defaultValue prop, but not ' +
@@ -501,7 +501,7 @@ describe('ReactDOMTextarea', () => {
501 <textarea value={Symbol('foobar')} onChange={() => {}} />,
502 container,
503 ),
504 - ).toWarnDev('Invalid value for prop `value`');
504 + ).toErrorDev('Invalid value for prop `value`');
505 const node = container.firstChild;
506
507 expect(node.value).toBe('');
@@ -514,7 +514,7 @@ describe('ReactDOMTextarea', () => {
514 <textarea onChange={() => {}}>{Symbol('foo')}</textarea>,
515 container,
516 ),
517 - ).toWarnDev('Use the `defaultValue` or `value` props');
517 + ).toErrorDev('Use the `defaultValue` or `value` props');
518 const node = container.firstChild;
519
520 expect(node.value).toBe('');
@@ -528,7 +528,7 @@ describe('ReactDOMTextarea', () => {
528 <textarea value={Symbol('foo')} onChange={() => {}} />,
529 container,
530 ),
531 - ).toWarnDev('Invalid value for prop `value`');
531 + ).toErrorDev('Invalid value for prop `value`');
532 const node = container.firstChild;
533
534 expect(node.value).toBe('');
@@ -562,7 +562,7 @@ describe('ReactDOMTextarea', () => {
562 <textarea value={() => {}} onChange={() => {}} />,
563 container,
564 ),
565 - ).toWarnDev('Invalid value for prop `value`');
565 + ).toErrorDev('Invalid value for prop `value`');
566 const node = container.firstChild;
567
568 expect(node.value).toBe('');
@@ -575,7 +575,7 @@ describe('ReactDOMTextarea', () => {
575 <textarea onChange={() => {}}>{() => {}}</textarea>,
576 container,
577 ),
578 - ).toWarnDev('Use the `defaultValue` or `value` props');
578 + ).toErrorDev('Use the `defaultValue` or `value` props');
579 const node = container.firstChild;
580
581 expect(node.value).toBe('');
@@ -589,7 +589,7 @@ describe('ReactDOMTextarea', () => {
589 <textarea value={() => {}} onChange={() => {}} />,
590 container,
591 ),
592 - ).toWarnDev('Invalid value for prop `value`');
592 + ).toErrorDev('Invalid value for prop `value`');
593 const node = container.firstChild;
594
595 expect(node.value).toBe('');
packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.internal.js
+2 -2
@@ -40,7 +40,7 @@ describe('ReactDeprecationWarnings', () => {
40 };
41
42 ReactNoop.render(<FunctionalComponent />);
43 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
43 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
44 'Warning: FunctionalComponent: Support for defaultProps ' +
45 'will be removed from function components in a future major ' +
46 'release. Use JavaScript default parameters instead.',
@@ -60,7 +60,7 @@ describe('ReactDeprecationWarnings', () => {
60 }
61
62 ReactNoop.render(<Component />);
63 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
63 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
64 'Warning: Component "Component" contains the string ref "refComponent". ' +
65 'Support for string refs will be removed in a future major release. ' +
66 'We recommend using useRef() or createRef() instead. ' +
packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js
+5 -5
@@ -653,7 +653,7 @@ describe('ReactErrorBoundaries', () => {
653 </ErrorBoundary>,
654 container,
655 ),
656 - ).toWarnDev('The above error occurred in the <BrokenRender> component:', {
656 + ).toErrorDev('The above error occurred in the <BrokenRender> component:', {
657 logAllErrors: true,
658 });
659
@@ -808,7 +808,7 @@ describe('ReactErrorBoundaries', () => {
808 </ErrorBoundary>,
809 container,
810 ),
811 - ).toWarnDev(
811 + ).toErrorDev(
812 'Warning: The <BrokenComponentWillMountWithContext /> component appears to be a function component that ' +
813 'returns a class instance. ' +
814 'Change BrokenComponentWillMountWithContext to a class that extends React.Component instead. ' +
@@ -2072,7 +2072,7 @@ describe('ReactErrorBoundaries', () => {
2072
2073 try {
2074 let container = document.createElement('div');
2075 - expect(() => ReactDOM.render(<X />, container)).toWarnDev(
2075 + expect(() => ReactDOM.render(<X />, container)).toErrorDev(
2076 'React.createElement: type is invalid -- expected a string ' +
2077 '(for built-in components) or a class/function ' +
2078 '(for composite components) but got: null.',
@@ -2082,7 +2082,7 @@ describe('ReactErrorBoundaries', () => {
2082 }
2083 try {
2084 let container = document.createElement('div');
2085 - expect(() => ReactDOM.render(<Y />, container)).toWarnDev(
2085 + expect(() => ReactDOM.render(<Y />, container)).toErrorDev(
2086 'React.createElement: type is invalid -- expected a string ' +
2087 '(for built-in components) or a class/function ' +
2088 '(for composite components) but got: undefined.',
@@ -2240,7 +2240,7 @@ describe('ReactErrorBoundaries', () => {
2240 </InvalidErrorBoundary>,
2241 container,
2242 );
2243 - }).toWarnDev(
2243 + }).toErrorDev(
2244 'InvalidErrorBoundary: Error boundaries should implement getDerivedStateFromError(). ' +
2245 'In that method, return a state update to display an error message or fallback UI.',
2246 );
packages/react-dom/src/__tests__/ReactFunctionComponent-test.js
+11 -11
@@ -108,7 +108,7 @@ describe('ReactFunctionComponent', () => {
108
109 expect(() =>
110 ReactDOM.render(<FunctionComponentWithChildContext />, container),
111 - ).toWarnDev(
111 + ).toErrorDev(
112 'FunctionComponentWithChildContext: Function ' +
113 'components do not support getDerivedStateFromProps.',
114 );
@@ -130,7 +130,7 @@ describe('ReactFunctionComponent', () => {
130 <FunctionComponentWithChildContext name="A" />,
131 container,
132 ),
133 - ).toWarnDev(
133 + ).toErrorDev(
134 'FunctionComponentWithChildContext(...): childContextTypes cannot ' +
135 'be defined on a function component.',
136 );
@@ -188,7 +188,7 @@ describe('ReactFunctionComponent', () => {
188
189 expect(() =>
190 ReactTestUtils.renderIntoDocument(<ParentUsingStringRef />),
191 - ).toWarnDev(
191 + ).toErrorDev(
192 'Warning: Function components cannot be given refs. ' +
193 'Attempts to access this ref will fail. ' +
194 'Did you mean to use React.forwardRef()?\n\n' +
@@ -226,7 +226,7 @@ describe('ReactFunctionComponent', () => {
226
227 expect(() =>
228 ReactTestUtils.renderIntoDocument(<ParentUsingFunctionRef />),
229 - ).toWarnDev(
229 + ).toErrorDev(
230 'Warning: Function components cannot be given refs. ' +
231 'Attempts to access this ref will fail. ' +
232 'Did you mean to use React.forwardRef()?\n\n' +
@@ -257,7 +257,7 @@ describe('ReactFunctionComponent', () => {
257 instance1 = ReactTestUtils.renderIntoDocument(
258 <AnonymousParentUsingJSX />,
259 );
260 - }).toWarnDev('Warning: Function components cannot be given refs.');
260 + }).toErrorDev('Warning: Function components cannot be given refs.');
261 // Should be deduped (offending element is on the same line):
262 instance1.forceUpdate();
263 // Should also be deduped (offending element is on the same line):
@@ -281,13 +281,13 @@ describe('ReactFunctionComponent', () => {
281 instance2 = ReactTestUtils.renderIntoDocument(
282 <AnonymousParentNotUsingJSX />,
283 );
284 - }).toWarnDev('Warning: Function components cannot be given refs.');
284 + }).toErrorDev('Warning: Function components cannot be given refs.');
285 // Should be deduped (same internal instance, no additional warnings)
286 instance2.forceUpdate();
287 // Could not be deduped (different internal instance):
288 expect(() =>
289 ReactTestUtils.renderIntoDocument(<AnonymousParentNotUsingJSX />),
290 - ).toWarnDev('Warning: Function components cannot be given refs.');
290 + ).toErrorDev('Warning: Function components cannot be given refs.');
291
292 // When owner doesn't use JSX, but is named, we warn once per owner name
293 class NamedParentNotUsingJSX extends React.Component {
@@ -301,7 +301,7 @@ describe('ReactFunctionComponent', () => {
301 let instance3;
302 expect(() => {
303 instance3 = ReactTestUtils.renderIntoDocument(<NamedParentNotUsingJSX />);
304 - }).toWarnDev('Warning: Function components cannot be given refs.');
304 + }).toErrorDev('Warning: Function components cannot be given refs.');
305 // Should be deduped (same owner name, no additional warnings):
306 instance3.forceUpdate();
307 // Should also be deduped (same owner name, no additional warnings):
@@ -332,7 +332,7 @@ describe('ReactFunctionComponent', () => {
332 }
333 }
334
335 - expect(() => ReactTestUtils.renderIntoDocument(<Parent />)).toWarnDev(
335 + expect(() => ReactTestUtils.renderIntoDocument(<Parent />)).toErrorDev(
336 'Warning: Function components cannot be given refs. ' +
337 'Attempts to access this ref will fail. ' +
338 'Did you mean to use React.forwardRef()?\n\n' +
@@ -357,7 +357,7 @@ describe('ReactFunctionComponent', () => {
357 return <div>{[<span />]}</div>;
358 }
359
360 - expect(() => ReactTestUtils.renderIntoDocument(<Child />)).toWarnDev(
360 + expect(() => ReactTestUtils.renderIntoDocument(<Child />)).toErrorDev(
361 'Each child in a list should have a unique "key" prop.\n\n' +
362 'Check the render method of `Child`.',
363 );
@@ -372,7 +372,7 @@ describe('ReactFunctionComponent', () => {
372 Child.defaultProps = {test: 2};
373 Child.propTypes = {test: PropTypes.string};
374
375 - expect(() => ReactTestUtils.renderIntoDocument(<Child />)).toWarnDev(
375 + expect(() => ReactTestUtils.renderIntoDocument(<Child />)).toErrorDev(
376 'Warning: Failed prop type: Invalid prop `test` of type `number` ' +
377 'supplied to `Child`, expected `string`.\n' +
378 ' in Child (at **)',
packages/react-dom/src/__tests__/ReactLegacyContextDisabled-test.internal.js
+1 -1
@@ -90,7 +90,7 @@ describe('ReactLegacyContextDisabled', () => {
90 </LegacyProvider>,
91 container,
92 );
93 - }).toWarnDev([
93 + }).toErrorDev([
94 'LegacyProvider uses the legacy childContextTypes API which is no longer supported. ' +
95 'Use React.createContext() instead.',
96 'LegacyClsConsumer uses the legacy contextTypes API which is no longer supported. ' +
packages/react-dom/src/__tests__/ReactLegacyErrorBoundaries-test.internal.js
+5 -5
@@ -675,7 +675,7 @@ describe('ReactLegacyErrorBoundaries', () => {
675 </BothErrorBoundaries>,
676 container,
677 ),
678 - ).toWarnDev('The above error occurred in the <BrokenRender> component', {
678 + ).toErrorDev('The above error occurred in the <BrokenRender> component', {
679 logAllErrors: true,
680 });
681
@@ -840,7 +840,7 @@ describe('ReactLegacyErrorBoundaries', () => {
840 </ErrorBoundary>,
841 container,
842 ),
843 - ).toWarnDev(
843 + ).toErrorDev(
844 'Warning: The <BrokenComponentWillMountWithContext /> component appears to be a function component that ' +
845 'returns a class instance. ' +
846 'Change BrokenComponentWillMountWithContext to a class that extends React.Component instead. ' +
@@ -2079,7 +2079,7 @@ describe('ReactLegacyErrorBoundaries', () => {
2079
2080 try {
2081 let container = document.createElement('div');
2082 - expect(() => ReactDOM.render(<X />, container)).toWarnDev(
2082 + expect(() => ReactDOM.render(<X />, container)).toErrorDev(
2083 'React.createElement: type is invalid -- expected a string ' +
2084 '(for built-in components) or a class/function ' +
2085 '(for composite components) but got: null.',
@@ -2089,7 +2089,7 @@ describe('ReactLegacyErrorBoundaries', () => {
2089 }
2090 try {
2091 let container = document.createElement('div');
2092 - expect(() => ReactDOM.render(<Y />, container)).toWarnDev(
2092 + expect(() => ReactDOM.render(<Y />, container)).toErrorDev(
2093 'React.createElement: type is invalid -- expected a string ' +
2094 '(for built-in components) or a class/function ' +
2095 '(for composite components) but got: undefined.',
@@ -2114,7 +2114,7 @@ describe('ReactLegacyErrorBoundaries', () => {
2114 </div>,
2115 container,
2116 );
2117 - }).toWarnDev(
2117 + }).toErrorDev(
2118 'ErrorBoundary: Error boundaries should implement getDerivedStateFromError()',
2119 );
2120 expect(container.firstChild.textContent).toBe('Sibling');
packages/react-dom/src/__tests__/ReactMount-test.js
+7 -7
@@ -59,7 +59,7 @@ describe('ReactMount', () => {
59 }
60 }
61
62 - expect(() => ReactTestUtils.renderIntoDocument(Component)).toWarnDev(
62 + expect(() => ReactTestUtils.renderIntoDocument(Component)).toErrorDev(
63 'Functions are not valid as a React child. ' +
64 'This may happen if you return a Component instead of <Component /> from render. ' +
65 'Or maybe you meant to call this function rather than return it.',
@@ -125,7 +125,7 @@ describe('ReactMount', () => {
125 const container = document.createElement('container');
126 container.innerHTML = ReactDOMServer.renderToString(<div />) + ' ';
127
128 - expect(() => ReactDOM.hydrate(<div />, container)).toWarnDev(
128 + expect(() => ReactDOM.hydrate(<div />, container)).toErrorDev(
129 'Did not expect server HTML to contain the text node " " in <container>.',
130 {withoutStack: true},
131 );
@@ -135,7 +135,7 @@ describe('ReactMount', () => {
135 const container = document.createElement('container');
136 container.innerHTML = ' ' + ReactDOMServer.renderToString(<div />);
137
138 - expect(() => ReactDOM.hydrate(<div />, container)).toWarnDev(
138 + expect(() => ReactDOM.hydrate(<div />, container)).toErrorDev(
139 'Did not expect server HTML to contain the text node " " in <container>.',
140 );
141 });
@@ -153,7 +153,7 @@ describe('ReactMount', () => {
153
154 expect(() =>
155 ReactDOM.render(<div />, iFrame.contentDocument.body),
156 - ).toWarnDev(
156 + ).toErrorDev(
157 'Rendering components directly into document.body is discouraged',
158 {withoutStack: true},
159 );
@@ -171,7 +171,7 @@ describe('ReactMount', () => {
171 <div>This markup contains an nbsp entity: &nbsp; client text</div>,
172 div,
173 ),
174 - ).toWarnDev(
174 + ).toErrorDev(
175 'Server: "This markup contains an nbsp entity:   server text" ' +
176 'Client: "This markup contains an nbsp entity:   client text"',
177 );
@@ -195,7 +195,7 @@ describe('ReactMount', () => {
195 // Test that blasting away children throws a warning
196 const rootNode = container.firstChild;
197
198 - expect(() => ReactDOM.render(<span />, rootNode)).toWarnDev(
198 + expect(() => ReactDOM.render(<span />, rootNode)).toErrorDev(
199 'Warning: render(...): Replacing React-rendered children with a new ' +
200 'root component. If you intended to update the children of this node, ' +
201 'you should instead have the existing children update their state and ' +
@@ -223,7 +223,7 @@ describe('ReactMount', () => {
223 // Make sure ReactDOM and ReactDOMOther are different copies
224 expect(ReactDOM).not.toEqual(ReactDOMOther);
225
226 - expect(() => ReactDOMOther.unmountComponentAtNode(container)).toWarnDev(
226 + expect(() => ReactDOMOther.unmountComponentAtNode(container)).toErrorDev(
227 "Warning: unmountComponentAtNode(): The node you're attempting to unmount " +
228 'was rendered by another copy of React.',
229 {withoutStack: true},
packages/react-dom/src/__tests__/ReactMountDestruction-test.js
+2 -2
@@ -50,7 +50,7 @@ describe('ReactMount', () => {
50
51 // Test that unmounting at a root node gives a helpful warning
52 const rootDiv = mainContainerDiv.firstChild;
53 - expect(() => ReactDOM.unmountComponentAtNode(rootDiv)).toWarnDev(
53 + expect(() => ReactDOM.unmountComponentAtNode(rootDiv)).toErrorDev(
54 "Warning: unmountComponentAtNode(): The node you're attempting to " +
55 'unmount was rendered by React and is not a top-level container. You ' +
56 'may have accidentally passed in a React root node instead of its ' +
@@ -73,7 +73,7 @@ describe('ReactMount', () => {
73
74 // Test that unmounting at a non-root node gives a different warning
75 const nonRootDiv = mainContainerDiv.firstChild.firstChild;
76 - expect(() => ReactDOM.unmountComponentAtNode(nonRootDiv)).toWarnDev(
76 + expect(() => ReactDOM.unmountComponentAtNode(nonRootDiv)).toErrorDev(
77 "Warning: unmountComponentAtNode(): The node you're attempting to " +
78 'unmount was rendered by React and is not a top-level container. ' +
79 'Instead, have the parent component update its state and rerender in ' +
packages/react-dom/src/__tests__/ReactMultiChild-test.js
+4 -4
@@ -204,7 +204,7 @@ describe('ReactMultiChild', () => {
204 <Parent>{[<div key="1" />, <div key="1" />]}</Parent>,
205 container,
206 ),
207 - ).toWarnDev(
207 + ).toErrorDev(
208 'Encountered two children with the same key, `1`. ' +
209 'Keys should be unique so that components maintain their identity ' +
210 'across updates. Non-unique keys may cause children to be ' +
@@ -264,7 +264,7 @@ describe('ReactMultiChild', () => {
264 <Parent>{createIterable([<div key="1" />, <div key="1" />])}</Parent>,
265 container,
266 ),
267 - ).toWarnDev(
267 + ).toErrorDev(
268 'Encountered two children with the same key, `1`. ' +
269 'Keys should be unique so that components maintain their identity ' +
270 'across updates. Non-unique keys may cause children to be ' +
@@ -285,7 +285,7 @@ describe('ReactMultiChild', () => {
285 }
286 }
287 const container = document.createElement('div');
288 - expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
288 + expect(() => ReactDOM.render(<Parent />, container)).toErrorDev(
289 'Warning: Using Maps as children is unsupported and will likely yield ' +
290 'unexpected results. Convert it to a sequence/iterable of keyed ' +
291 'ReactElements instead.\n' +
@@ -303,7 +303,7 @@ describe('ReactMultiChild', () => {
303 const div = document.createElement('div');
304 expect(() => {
305 ReactDOM.render(<Foo />, div);
306 - }).toWarnDev(
306 + }).toErrorDev(
307 'Using Generators as children is unsupported and will likely yield ' +
308 'unexpected results because enumerating a generator mutates it. You may ' +
309 'convert it to an array with `Array.from()` or the `[...spread]` operator ' +
packages/react-dom/src/__tests__/ReactMultiChildText-test.js
+1 -1
@@ -161,7 +161,7 @@ describe('ReactMultiChildText', () => {
161 [true, <div>{1.2}{''}{<div />}{'foo'}</div>, true, 1.2], [<div />, '1.2'],
162 ['', 'foo', <div>{true}{<div />}{1.2}{''}</div>, 'foo'], ['', 'foo', <div />, 'foo'],
163 ]);
164 - }).toWarnDev([
164 + }).toErrorDev([
165 'Warning: Each child in a list should have a unique "key" prop.',
166 'Warning: Each child in a list should have a unique "key" prop.',
167 ]);
packages/react-dom/src/__tests__/ReactRenderDocument-test.js
+6 -6
@@ -35,7 +35,7 @@ describe('rendering React components at document', () => {
35
36 describe('with old implicit hydration API', () => {
37 function expectDeprecationWarningWithFiber(callback) {
38 - expect(callback).toLowPriorityWarnDev(
38 + expect(callback).toWarnDev(
39 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
40 'will stop working in React v17. Replace the ReactDOM.render() call ' +
41 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
@@ -197,13 +197,13 @@ describe('rendering React components at document', () => {
197 expect(() => {
198 expect(() =>
199 ReactDOM.render(<Component text="Hello world" />, testDocument),
200 - ).toLowPriorityWarnDev(
200 + ).toWarnDev(
201 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
202 'will stop working in React v17. Replace the ReactDOM.render() call ' +
203 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
204 {withoutStack: true},
205 );
206 - }).toWarnDev('Warning: Text content did not match.');
206 + }).toErrorDev('Warning: Text content did not match.');
207 });
208
209 it('should throw on full document render w/ no markup', () => {
@@ -369,7 +369,7 @@ describe('rendering React components at document', () => {
369 it('renders over an existing text child without throwing', () => {
370 const container = document.createElement('div');
371 container.textContent = 'potato';
372 - expect(() => ReactDOM.hydrate(<div>parsnip</div>, container)).toWarnDev(
372 + expect(() => ReactDOM.hydrate(<div>parsnip</div>, container)).toErrorDev(
373 'Expected server HTML to contain a matching <div> in <div>.',
374 );
375 expect(container.textContent).toBe('parsnip');
@@ -396,7 +396,7 @@ describe('rendering React components at document', () => {
396
397 expect(() =>
398 ReactDOM.hydrate(<Component text="Hello world" />, testDocument),
399 - ).toWarnDev('Warning: Text content did not match.');
399 + ).toErrorDev('Warning: Text content did not match.');
400 expect(testDocument.body.innerHTML).toBe('Hello world');
401 });
402
@@ -419,7 +419,7 @@ describe('rendering React components at document', () => {
419 // getTestDocument() has an extra <meta> that we didn't render.
420 expect(() =>
421 ReactDOM.hydrate(<Component text="Hello world" />, testDocument),
422 - ).toWarnDev('Did not expect server HTML to contain a <meta> in <head>.');
422 + ).toErrorDev('Did not expect server HTML to contain a <meta> in <head>.');
423 expect(testDocument.body.innerHTML).toBe('Hello world');
424 });
425
packages/react-dom/src/__tests__/ReactServerRendering-test.js
+13 -13
@@ -188,7 +188,7 @@ describe('ReactDOMServer', () => {
188 <span unknown="test" />
189 </div>,
190 )),
191 - ).toWarnDev(['React does not recognize the `hasOwnProperty` prop']);
191 + ).toErrorDev(['React does not recognize the `hasOwnProperty` prop']);
192 expect(html).toContain('<span unknown="test">');
193 });
194 });
@@ -644,7 +644,7 @@ describe('ReactDOMServer', () => {
644 }
645
646 ReactDOMServer.renderToString(<Foo />);
647 - expect(() => jest.runOnlyPendingTimers()).toWarnDev(
647 + expect(() => jest.runOnlyPendingTimers()).toErrorDev(
648 'Warning: setState(...): Can only update a mounting component.' +
649 ' This usually means you called setState() outside componentWillMount() on the server.' +
650 ' This is a no-op.\n\nPlease check the code for the Foo component.',
@@ -672,7 +672,7 @@ describe('ReactDOMServer', () => {
672 }
673
674 ReactDOMServer.renderToString(<Baz />);
675 - expect(() => jest.runOnlyPendingTimers()).toWarnDev(
675 + expect(() => jest.runOnlyPendingTimers()).toErrorDev(
676 'Warning: forceUpdate(...): Can only update a mounting component. ' +
677 'This usually means you called forceUpdate() outside componentWillMount() on the server. ' +
678 'This is a no-op.\n\nPlease check the code for the Baz component.',
@@ -819,7 +819,7 @@ describe('ReactDOMServer', () => {
819 </svg>
820 </div>,
821 ),
822 - ).toWarnDev([
822 + ).toErrorDev([
823 'Warning: <inPUT /> is using incorrect casing. ' +
824 'Use PascalCase for React components, ' +
825 'or lowercase for HTML elements.',
@@ -833,7 +833,7 @@ describe('ReactDOMServer', () => {
833 it('should warn about contentEditable and children', () => {
834 expect(() =>
835 ReactDOMServer.renderToString(<div contentEditable={true} children="" />),
836 - ).toWarnDev(
836 + ).toErrorDev(
837 'Warning: A component is `contentEditable` and contains `children` ' +
838 'managed by React. It is now your responsibility to guarantee that ' +
839 'none of those nodes are unexpectedly modified or duplicated. This ' +
@@ -852,7 +852,7 @@ describe('ReactDOMServer', () => {
852 expect(() =>
853 ReactDOMServer.renderToString(<ClassWithRenderNotExtended />),
854 ).toThrow(TypeError);
855 - }).toWarnDev(
855 + }).toErrorDev(
856 'Warning: The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
857 "but doesn't extend React.Component. This is likely to cause errors. " +
858 'Change ClassWithRenderNotExtended to extend React.Component instead.',
@@ -921,7 +921,7 @@ describe('ReactDOMServer', () => {
921 );
922 }
923
924 - expect(() => ReactDOMServer.renderToString(<App />)).toWarnDev([
924 + expect(() => ReactDOMServer.renderToString(<App />)).toErrorDev([
925 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
926 ' in span (at **)\n' +
927 ' in b (at **)\n' +
@@ -970,7 +970,7 @@ describe('ReactDOMServer', () => {
970 );
971 }
972
973 - expect(() => ReactDOMServer.renderToString(<App />)).toWarnDev([
973 + expect(() => ReactDOMServer.renderToString(<App />)).toErrorDev([
974 // ReactDOMServer(App > div > span)
975 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
976 ' in span (at **)\n' +
@@ -1017,7 +1017,7 @@ describe('ReactDOMServer', () => {
1017
1018 expect(() => {
1019 ReactDOMServer.renderToString(<ComponentA />);
1020 - }).toWarnDev(
1020 + }).toErrorDev(
1021 'Warning: ComponentA defines an invalid contextType. ' +
1022 'contextType should point to the Context object returned by React.createContext(). ' +
1023 'Did you accidentally pass the Context.Consumer instead?',
@@ -1028,7 +1028,7 @@ describe('ReactDOMServer', () => {
1028
1029 expect(() => {
1030 ReactDOMServer.renderToString(<ComponentB />);
1031 - }).toWarnDev(
1031 + }).toErrorDev(
1032 'Warning: ComponentB defines an invalid contextType. ' +
1033 'contextType should point to the Context object returned by React.createContext(). ' +
1034 'Did you accidentally pass the Context.Provider instead?',
@@ -1062,7 +1062,7 @@ describe('ReactDOMServer', () => {
1062 expect(() => {
1063 ReactDOMServer.renderToString(<Foo />);
1064 }).toThrow("Cannot read property 'world' of undefined");
1065 - }).toWarnDev(
1065 + }).toErrorDev(
1066 'Foo defines an invalid contextType. ' +
1067 'contextType should point to the Context object returned by React.createContext(). ' +
1068 'However, it is set to undefined. ' +
@@ -1088,7 +1088,7 @@ describe('ReactDOMServer', () => {
1088 expect(() => {
1089 ReactDOMServer.renderToString(<Foo />);
1090 }).toThrow("Cannot read property 'hello' of undefined");
1091 - }).toWarnDev(
1091 + }).toErrorDev(
1092 'Foo defines an invalid contextType. ' +
1093 'contextType should point to the Context object returned by React.createContext(). ' +
1094 'However, it is set to an object with keys {x, y}.',
@@ -1107,7 +1107,7 @@ describe('ReactDOMServer', () => {
1107 expect(() => {
1108 ReactDOMServer.renderToString(<Foo />);
1109 }).toThrow("Cannot read property 'world' of undefined");
1110 - }).toWarnDev(
1110 + }).toErrorDev(
1111 'Foo defines an invalid contextType. ' +
1112 'contextType should point to the Context object returned by React.createContext(). ' +
1113 'However, it is set to a string.',
packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js
+9 -9
@@ -81,7 +81,7 @@ describe('ReactDOMServerHydration', () => {
81
82 expect(() => {
83 instance = ReactDOM.render(<TestComponent name="x" />, element);
84 - }).toLowPriorityWarnDev(
84 + }).toWarnDev(
85 'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
86 'will stop working in React v17. Replace the ReactDOM.render() call ' +
87 'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
@@ -104,7 +104,7 @@ describe('ReactDOMServerHydration', () => {
104 element.innerHTML = lastMarkup;
105 expect(() => {
106 instance = ReactDOM.render(<TestComponent name="y" />, element);
107 - }).toWarnDev('Text content did not match. Server: "x" Client: "y"');
107 + }).toErrorDev('Text content did not match. Server: "x" Client: "y"');
108 expect(mountCount).toEqual(4);
109 expect(element.innerHTML.length > 0).toBe(true);
110 expect(element.innerHTML).not.toEqual(lastMarkup);
@@ -187,7 +187,7 @@ describe('ReactDOMServerHydration', () => {
187 element.innerHTML = lastMarkup;
188 expect(() => {
189 instance = ReactDOM.hydrate(<TestComponent name="y" />, element);
190 - }).toWarnDev('Text content did not match. Server: "x" Client: "y"');
190 + }).toErrorDev('Text content did not match. Server: "x" Client: "y"');
191 expect(mountCount).toEqual(4);
192 expect(element.innerHTML.length > 0).toBe(true);
193 expect(element.innerHTML).not.toEqual(lastMarkup);
@@ -248,7 +248,7 @@ describe('ReactDOMServerHydration', () => {
248
249 expect(() =>
250 ReactDOM.hydrate(<button autoFocus={false}>client</button>, element),
251 - ).toWarnDev(
251 + ).toErrorDev(
252 'Warning: Text content did not match. Server: "server" Client: "client"',
253 );
254
@@ -270,7 +270,7 @@ describe('ReactDOMServerHydration', () => {
270 />,
271 element,
272 ),
273 - ).toWarnDev(
273 + ).toErrorDev(
274 'Warning: Prop `style` did not match. Server: ' +
275 '"text-decoration:none;color:black;height:10px" Client: ' +
276 '"text-decoration:none;color:white;height:10px"',
@@ -317,7 +317,7 @@ describe('ReactDOMServerHydration', () => {
317 />,
318 element,
319 ),
320 - ).toWarnDev(
320 + ).toErrorDev(
321 'Warning: Prop `style` did not match. Server: ' +
322 '"text-decoration: none; color: black; height: 10px;" Client: ' +
323 '"text-decoration:none;color:black;height:10px"',
@@ -355,12 +355,12 @@ describe('ReactDOMServerHydration', () => {
355 const element = document.createElement('div');
356 expect(() => {
357 element.innerHTML = ReactDOMServer.renderToString(markup);
358 - }).toLowPriorityWarnDev('componentWillMount has been renamed');
358 + }).toWarnDev('componentWillMount has been renamed');
359 expect(element.textContent).toBe('Hi');
360
361 expect(() => {
362 ReactDOM.hydrate(markup, element);
363 - }).toLowPriorityWarnDev('componentWillMount has been renamed', {
363 + }).toWarnDev('componentWillMount has been renamed', {
364 withoutStack: true,
365 });
366 expect(element.textContent).toBe('Hi');
@@ -521,7 +521,7 @@ describe('ReactDOMServerHydration', () => {
521 </React.Suspense>,
522 element,
523 ),
524 - ).toWarnDev(
524 + ).toErrorDev(
525 'Warning: Did not expect server HTML to contain a <div> in <div>.',
526 {withoutStack: true},
527 );
packages/react-dom/src/__tests__/ReactTestUtils-test.js
+1 -3
@@ -53,9 +53,7 @@ describe('ReactTestUtils', () => {
53 MockedComponent.prototype.render = jest.fn();
54
55 // Patch it up so it returns its children.
56 - expect(() =>
57 - ReactTestUtils.mockComponent(MockedComponent),
58 - ).toLowPriorityWarnDev(
56 + expect(() => ReactTestUtils.mockComponent(MockedComponent)).toWarnDev(
57 'ReactTestUtils.mockComponent() is deprecated. ' +
58 'Use shallow rendering or jest.mock() instead.\n\n' +
59 'See https://fb.me/test-utils-mock-component for more information.',
packages/react-dom/src/__tests__/ReactTestUtilsAct-test.js
+8 -8
@@ -108,7 +108,7 @@ describe('ReactTestUtils.act()', () => {
108 it('does not warn in legacy mode', () => {
109 expect(() => {
110 ReactDOM.render(<App />, document.createElement('div'));
111 - }).toWarnDev([]);
111 + }).toErrorDev([]);
112 });
113
114 it('warns in strict mode', () => {
@@ -119,7 +119,7 @@ describe('ReactTestUtils.act()', () => {
119 </React.StrictMode>,
120 document.createElement('div'),
121 );
122 - }).toWarnDev([
122 + }).toErrorDev([
123 'An update to App ran an effect, but was not wrapped in act(...)',
124 'An update to App ran an effect, but was not wrapped in act(...)',
125 ]);
@@ -130,7 +130,7 @@ describe('ReactTestUtils.act()', () => {
130 const root = ReactDOM.createBlockingRoot(document.createElement('div'));
131 root.render(<App />);
132 Scheduler.unstable_flushAll();
133 - }).toWarnDev([
133 + }).toErrorDev([
134 'An update to App ran an effect, but was not wrapped in act(...)',
135 'An update to App ran an effect, but was not wrapped in act(...)',
136 ]);
@@ -141,7 +141,7 @@ describe('ReactTestUtils.act()', () => {
141 const root = ReactDOM.createRoot(document.createElement('div'));
142 root.render(<App />);
143 Scheduler.unstable_flushAll();
144 - }).toWarnDev([
144 + }).toErrorDev([
145 'An update to App ran an effect, but was not wrapped in act(...)',
146 'An update to App ran an effect, but was not wrapped in act(...)',
147 ]);
@@ -270,7 +270,7 @@ function runActTests(label, render, unmount, rerender) {
270 render(<App />, container);
271 });
272
273 - expect(() => setValue(1)).toWarnDev([
273 + expect(() => setValue(1)).toErrorDev([
274 'An update to App inside a test was not wrapped in act(...).',
275 ]);
276 });
@@ -384,13 +384,13 @@ function runActTests(label, render, unmount, rerender) {
384 });
385
386 it('warns if you return a value inside act', () => {
387 - expect(() => act(() => null)).toWarnDev(
387 + expect(() => act(() => null)).toErrorDev(
388 [
389 'The callback passed to act(...) function must return undefined, or a Promise.',
390 ],
391 {withoutStack: true},
392 );
393 - expect(() => act(() => 123)).toWarnDev(
393 + expect(() => act(() => 123)).toErrorDev(
394 [
395 'The callback passed to act(...) function must return undefined, or a Promise.',
396 ],
@@ -399,7 +399,7 @@ function runActTests(label, render, unmount, rerender) {
399 });
400
401 it('warns if you try to await a sync .act call', () => {
402 - expect(() => act(() => {}).then(() => {})).toWarnDev(
402 + expect(() => act(() => {}).then(() => {})).toErrorDev(
403 [
404 'Do not await the result of calling act(...) with sync logic, it is not a Promise.',
405 ],
packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js
+3 -3
@@ -31,14 +31,14 @@ afterEach(() => {
31 it('should warn in legacy mode', () => {
32 expect(() => {
33 ReactDOM.render(<App />, document.createElement('div'));
34 - }).toWarnDev(
34 + }).toErrorDev(
35 ['Starting from React v17, the "scheduler" module will need to be mocked'],
36 {withoutStack: true},
37 );
38 // does not warn twice
39 expect(() => {
40 ReactDOM.render(<App />, document.createElement('div'));
41 - }).toWarnDev([]);
41 + }).toErrorDev([]);
42 });
43
44 it('does not warn if Scheduler is mocked', () => {
@@ -52,5 +52,5 @@ it('does not warn if Scheduler is mocked', () => {
52 // This should not warn
53 expect(() => {
54 ReactDOM.render(<App />, document.createElement('div'));
55 - }).toWarnDev([]);
55 + }).toErrorDev([]);
56 });
packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.js
+5 -5
@@ -24,13 +24,13 @@ beforeEach(() => {
24 it('does not warn when rendering in legacy mode', () => {
25 expect(() => {
26 ReactDOM.render(<App />, document.createElement('div'));
27 - }).toWarnDev([]);
27 + }).toErrorDev([]);
28 });
29
30 it.experimental('should warn when rendering in concurrent mode', () => {
31 expect(() => {
32 ReactDOM.createRoot(document.createElement('div')).render(<App />);
33 - }).toWarnDev(
33 + }).toErrorDev(
34 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' +
35 'to guarantee consistent behaviour across tests and browsers.',
36 {withoutStack: true},
@@ -38,13 +38,13 @@ it.experimental('should warn when rendering in concurrent mode', () => {
38 // does not warn twice
39 expect(() => {
40 ReactDOM.createRoot(document.createElement('div')).render(<App />);
41 - }).toWarnDev([]);
41 + }).toErrorDev([]);
42 });
43
44 it.experimental('should warn when rendering in blocking mode', () => {
45 expect(() => {
46 ReactDOM.createBlockingRoot(document.createElement('div')).render(<App />);
47 - }).toWarnDev(
47 + }).toErrorDev(
48 'In Concurrent or Sync modes, the "scheduler" module needs to be mocked ' +
49 'to guarantee consistent behaviour across tests and browsers.',
50 {withoutStack: true},
@@ -52,5 +52,5 @@ it.experimental('should warn when rendering in blocking mode', () => {
52 // does not warn twice
53 expect(() => {
54 ReactDOM.createBlockingRoot(document.createElement('div')).render(<App />);
55 - }).toWarnDev([]);
55 + }).toErrorDev([]);
56 });
packages/react-dom/src/__tests__/ReactUpdates-test.js
+5 -5
@@ -863,7 +863,7 @@ describe('ReactUpdates', () => {
863 let component = ReactTestUtils.renderIntoDocument(<A />);
864
865 expect(() => {
866 - expect(() => component.setState({}, 'no')).toWarnDev(
866 + expect(() => component.setState({}, 'no')).toErrorDev(
867 'setState(...): Expected the last optional `callback` argument to be ' +
868 'a function. Instead received: no.',
869 );
@@ -873,7 +873,7 @@ describe('ReactUpdates', () => {
873 );
874 component = ReactTestUtils.renderIntoDocument(<A />);
875 expect(() => {
876 - expect(() => component.setState({}, {foo: 'bar'})).toWarnDev(
876 + expect(() => component.setState({}, {foo: 'bar'})).toErrorDev(
877 'setState(...): Expected the last optional `callback` argument to be ' +
878 'a function. Instead received: [object Object].',
879 );
@@ -906,7 +906,7 @@ describe('ReactUpdates', () => {
906 let component = ReactTestUtils.renderIntoDocument(<A />);
907
908 expect(() => {
909 - expect(() => component.forceUpdate('no')).toWarnDev(
909 + expect(() => component.forceUpdate('no')).toErrorDev(
910 'forceUpdate(...): Expected the last optional `callback` argument to be ' +
911 'a function. Instead received: no.',
912 );
@@ -916,7 +916,7 @@ describe('ReactUpdates', () => {
916 );
917 component = ReactTestUtils.renderIntoDocument(<A />);
918 expect(() => {
919 - expect(() => component.forceUpdate({foo: 'bar'})).toWarnDev(
919 + expect(() => component.forceUpdate({foo: 'bar'})).toErrorDev(
920 'forceUpdate(...): Expected the last optional `callback` argument to be ' +
921 'a function. Instead received: [object Object].',
922 );
@@ -1229,7 +1229,7 @@ describe('ReactUpdates', () => {
1229 }
1230
1231 const container = document.createElement('div');
1232 - expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
1232 + expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
1233 'Cannot update during an existing state transition',
1234 );
1235 expect(ops).toEqual(['base: 0, memoized: 0', 'base: 1, memoized: 1']);
packages/react-dom/src/__tests__/findDOMNode-test.js
+2 -2
@@ -117,7 +117,7 @@ describe('findDOMNode', () => {
117 );
118
119 let match;
120 - expect(() => (match = ReactDOM.findDOMNode(parent))).toWarnDev([
120 + expect(() => (match = ReactDOM.findDOMNode(parent))).toErrorDev([
121 'Warning: findDOMNode is deprecated in StrictMode. ' +
122 'findDOMNode was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
123 'Instead, add a ref directly to the element you want to reference. ' +
@@ -147,7 +147,7 @@ describe('findDOMNode', () => {
147 );
148
149 let match;
150 - expect(() => (match = ReactDOM.findDOMNode(parent))).toWarnDev([
150 + expect(() => (match = ReactDOM.findDOMNode(parent))).toErrorDev([
151 'Warning: findDOMNode is deprecated in StrictMode. ' +
152 'findDOMNode was passed an instance of IsInStrictMode which is inside StrictMode. ' +
153 'Instead, add a ref directly to the element you want to reference. ' +
packages/react-dom/src/__tests__/refs-test.js
+1 -1
@@ -169,7 +169,7 @@ describe('factory components', () => {
169 let inst;
170 expect(
171 () => (inst = ReactTestUtils.renderIntoDocument(<Comp />)),
172 - ).toWarnDev(
172 + ).toErrorDev(
173 'Warning: The <Comp /> component appears to be a function component that returns a class instance. ' +
174 'Change Comp to a class that extends React.Component instead. ' +
175 "If you can't use a class try assigning the prototype on the function as a workaround. " +
packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js
+1 -1
@@ -69,7 +69,7 @@ module.exports = function(initModules) {
69 console.error.calls.reset();
70 } else {
71 // TODO: Rewrite tests that use this helper to enumerate expected errors.
72 - // This will enable the helper to use the .toWarnDev() matcher instead of spying.
72 + // This will enable the helper to use the .toErrorDev() matcher instead of spying.
73 spyOnDev(console, 'error');
74 }
75
packages/react-dom/src/__tests__/validateDOMNesting-test.js
+1 -1
@@ -28,7 +28,7 @@ function expectWarnings(tags, warnings = [], withoutStack = 0) {
28 element = <Tag>{element}</Tag>;
29 }
30
31 - expect(() => ReactDOM.render(element, container)).toWarnDev(warnings, {
31 + expect(() => ReactDOM.render(element, container)).toErrorDev(warnings, {
32 withoutStack,
33 });
34 }
packages/react-dom/src/client/__tests__/trustedTypes-test.internal.js
+2 -2
@@ -216,7 +216,7 @@ describe('when Trusted Types are available in global object', () => {
216 }
217 expect(() => {
218 ReactDOM.render(<Component />, container);
219 - }).toWarnDev(
219 + }).toErrorDev(
220 "Warning: Using 'dangerouslySetInnerHTML' in an svg element with " +
221 'Trusted Types enabled in an Internet Explorer will cause ' +
222 'the trusted value to be converted to string. Assigning string ' +
@@ -231,7 +231,7 @@ describe('when Trusted Types are available in global object', () => {
231 it('should warn once when rendering script tag in jsx on client', () => {
232 expect(() => {
233 ReactDOM.render(<script>alert("I am not executed")</script>, container);
234 - }).toWarnDev(
234 + }).toErrorDev(
235 'Warning: Encountered a script tag while rendering React component. ' +
236 'Scripts inside React components are never executed when rendering ' +
237 'on the client. Consider using template tag instead ' +
packages/react-dom/src/events/__tests__/DOMEventResponderSystem-test.internal.js
+4 -4
@@ -274,7 +274,7 @@ describe('DOMEventResponderSystem', () => {
274
275 expect(() => {
276 ReactDOM.render(<Test />, container);
277 - }).toWarnDev(
277 + }).toErrorDev(
278 'Duplicate event responder "TestEventResponder" found in event listeners. ' +
279 'Event listeners passed to elements cannot use the same event responder more than once.',
280 );
@@ -707,7 +707,7 @@ describe('DOMEventResponderSystem', () => {
707 };
708 ReactDOM.render(<Test />, container);
709 dispatchClickEvent(buttonRef.current);
710 - }).toWarnDev(
710 + }).toErrorDev(
711 'Warning: isDefaultPrevented() is not available on event objects created from event responder modules ' +
712 '(React Flare).' +
713 ' Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.isDefaultPrevented() }`',
@@ -719,7 +719,7 @@ describe('DOMEventResponderSystem', () => {
719 };
720 ReactDOM.render(<Test />, container);
721 dispatchClickEvent(buttonRef.current);
722 - }).toWarnDev(
722 + }).toErrorDev(
723 'Warning: isPropagationStopped() is not available on event objects created from event responder modules ' +
724 '(React Flare).' +
725 ' Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.isPropagationStopped() }`',
@@ -731,7 +731,7 @@ describe('DOMEventResponderSystem', () => {
731 };
732 ReactDOM.render(<Test />, container);
733 dispatchClickEvent(buttonRef.current);
734 - }).toWarnDev(
734 + }).toErrorDev(
735 'Warning: nativeEvent is not available on event objects created from event responder modules ' +
736 '(React Flare).' +
737 ' Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.nativeEvent }`',
packages/react-dom/src/events/__tests__/SyntheticEvent-test.js
+10 -10
@@ -151,15 +151,15 @@ describe('SyntheticEvent', () => {
151 'See https://fb.me/react-event-pooling for more information.';
152
153 // once for each property accessed
154 - expect(() => expect(syntheticEvent.type).toBe(null)).toWarnDev(
154 + expect(() => expect(syntheticEvent.type).toBe(null)).toErrorDev(
155 getExpectedWarning('type'),
156 {withoutStack: true},
157 );
158 - expect(() => expect(syntheticEvent.nativeEvent).toBe(null)).toWarnDev(
158 + expect(() => expect(syntheticEvent.nativeEvent).toBe(null)).toErrorDev(
159 getExpectedWarning('nativeEvent'),
160 {withoutStack: true},
161 );
162 - expect(() => expect(syntheticEvent.target).toBe(null)).toWarnDev(
162 + expect(() => expect(syntheticEvent.target).toBe(null)).toErrorDev(
163 getExpectedWarning('target'),
164 {withoutStack: true},
165 );
@@ -185,7 +185,7 @@ describe('SyntheticEvent', () => {
185
186 expect(() => {
187 syntheticEvent.type = 'MouseEvent';
188 - }).toWarnDev(
188 + }).toErrorDev(
189 'Warning: This synthetic event is reused for performance reasons. If ' +
190 "you're seeing this, you're setting the property `type` on a " +
191 'released/nullified synthetic event. This is effectively a no-op. If you must ' +
@@ -211,7 +211,7 @@ describe('SyntheticEvent', () => {
211 event.initEvent('click', true, true);
212 node.dispatchEvent(event);
213
214 - expect(() => syntheticEvent.preventDefault()).toWarnDev(
214 + expect(() => syntheticEvent.preventDefault()).toErrorDev(
215 'Warning: This synthetic event is reused for performance reasons. If ' +
216 "you're seeing this, you're accessing the method `preventDefault` on a " +
217 'released/nullified synthetic event. This is a no-op function. If you must ' +
@@ -238,7 +238,7 @@ describe('SyntheticEvent', () => {
238
239 node.dispatchEvent(event);
240
241 - expect(() => syntheticEvent.stopPropagation()).toWarnDev(
241 + expect(() => syntheticEvent.stopPropagation()).toErrorDev(
242 'Warning: This synthetic event is reused for performance reasons. If ' +
243 "you're seeing this, you're accessing the method `stopPropagation` on a " +
244 'released/nullified synthetic event. This is a no-op function. If you must ' +
@@ -266,7 +266,7 @@ describe('SyntheticEvent', () => {
266
267 expect(() =>
268 expect(syntheticEvent.isPropagationStopped()).toBe(false),
269 - ).toWarnDev(
269 + ).toErrorDev(
270 'Warning: This synthetic event is reused for performance reasons. If ' +
271 "you're seeing this, you're accessing the method `isPropagationStopped` on a " +
272 'released/nullified synthetic event. This is a no-op function. If you must ' +
@@ -294,7 +294,7 @@ describe('SyntheticEvent', () => {
294
295 expect(() =>
296 expect(syntheticEvent.isDefaultPrevented()).toBe(false),
297 - ).toWarnDev(
297 + ).toErrorDev(
298 'Warning: This synthetic event is reused for performance reasons. If ' +
299 "you're seeing this, you're accessing the method `isDefaultPrevented` on a " +
300 'released/nullified synthetic event. This is a no-op function. If you must ' +
@@ -316,7 +316,7 @@ describe('SyntheticEvent', () => {
316 // access a property to cause the warning
317 expect(() => {
318 event.nativeEvent; // eslint-disable-line no-unused-expressions
319 - }).toWarnDev(
319 + }).toErrorDev(
320 'Warning: This synthetic event is reused for performance reasons. If ' +
321 "you're seeing this, you're accessing the property `nativeEvent` on a " +
322 'released/nullified synthetic event. This is set to null. If you must ' +
@@ -338,7 +338,7 @@ describe('SyntheticEvent', () => {
338 const eventHandler = e => {
339 expect(() => {
340 e.foo = 'bar';
341 - }).toWarnDev(
341 + }).toErrorDev(
342 'Warning: This synthetic event is reused for performance reasons. If ' +
343 "you're seeing this, you're adding a new property in the synthetic " +
344 'event object. The property is never released. ' +
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+8 -8
@@ -243,7 +243,7 @@ describe('ReactFabric', () => {
243
244 expect(() => {
245 viewRef.setNativeProps({});
246 - }).toWarnDev([SET_NATIVE_PROPS_NOT_SUPPORTED_MESSAGE], {
246 + }).toErrorDev([SET_NATIVE_PROPS_NOT_SUPPORTED_MESSAGE], {
247 withoutStack: true,
248 });
249
@@ -251,7 +251,7 @@ describe('ReactFabric', () => {
251
252 expect(() => {
253 viewRef.setNativeProps({foo: 'baz'});
254 - }).toWarnDev([SET_NATIVE_PROPS_NOT_SUPPORTED_MESSAGE], {
254 + }).toErrorDev([SET_NATIVE_PROPS_NOT_SUPPORTED_MESSAGE], {
255 withoutStack: true,
256 });
257 expect(UIManager.updateView).not.toBeCalled();
@@ -329,7 +329,7 @@ describe('ReactFabric', () => {
329 expect(nativeFabricUIManager.dispatchCommand).not.toBeCalled();
330 expect(() => {
331 ReactFabric.dispatchCommand(viewRef, 'updateCommand', [10, 20]);
332 - }).toWarnDev([DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT], {
332 + }).toErrorDev([DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT], {
333 withoutStack: true,
334 });
335
@@ -503,7 +503,7 @@ describe('ReactFabric', () => {
503
504 expect(() => {
505 viewRef.measureLayout(otherRef, successCallback, failureCallback);
506 - }).toWarnDev(
506 + }).toErrorDev(
507 [
508 'Warning: measureLayout on components using NativeMethodsMixin ' +
509 'or ReactNative.NativeComponent is not currently supported in Fabric. ' +
@@ -1005,7 +1005,7 @@ describe('ReactFabric', () => {
1005 let match;
1006 expect(
1007 () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
1008 - ).toWarnDev([
1008 + ).toErrorDev([
1009 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
1010 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
1011 'Instead, add a ref directly to the element you want to reference. ' +
@@ -1043,7 +1043,7 @@ describe('ReactFabric', () => {
1043 let match;
1044 expect(
1045 () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
1046 - ).toWarnDev([
1046 + ).toErrorDev([
1047 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
1048 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
1049 'Instead, add a ref directly to the element you want to reference. ' +
@@ -1078,7 +1078,7 @@ describe('ReactFabric', () => {
1078 ReactFabric.render(<ContainsStrictModeChild ref={n => (parent = n)} />, 11);
1079
1080 let match;
1081 - expect(() => (match = ReactFabric.findNodeHandle(parent))).toWarnDev([
1081 + expect(() => (match = ReactFabric.findNodeHandle(parent))).toErrorDev([
1082 'Warning: findNodeHandle is deprecated in StrictMode. ' +
1083 'findNodeHandle was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
1084 'Instead, add a ref directly to the element you want to reference. ' +
@@ -1114,7 +1114,7 @@ describe('ReactFabric', () => {
1114 );
1115
1116 let match;
1117 - expect(() => (match = ReactFabric.findNodeHandle(parent))).toWarnDev([
1117 + expect(() => (match = ReactFabric.findNodeHandle(parent))).toErrorDev([
1118 'Warning: findNodeHandle is deprecated in StrictMode. ' +
1119 'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
1120 'Instead, add a ref directly to the element you want to reference. ' +
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+5 -5
@@ -174,7 +174,7 @@ describe('ReactNative', () => {
174 expect(UIManager.dispatchViewManagerCommand).not.toBeCalled();
175 expect(() => {
176 ReactNative.dispatchCommand(viewRef, 'updateCommand', [10, 20]);
177 - }).toWarnDev([DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT], {
177 + }).toErrorDev([DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT], {
178 withoutStack: true,
179 });
180
@@ -565,7 +565,7 @@ describe('ReactNative', () => {
565 let match;
566 expect(
567 () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
568 - ).toWarnDev([
568 + ).toErrorDev([
569 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
570 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
571 'Instead, add a ref directly to the element you want to reference. ' +
@@ -603,7 +603,7 @@ describe('ReactNative', () => {
603 let match;
604 expect(
605 () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
606 - ).toWarnDev([
606 + ).toErrorDev([
607 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
608 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
609 'Instead, add a ref directly to the element you want to reference. ' +
@@ -638,7 +638,7 @@ describe('ReactNative', () => {
638 ReactNative.render(<ContainsStrictModeChild ref={n => (parent = n)} />, 11);
639
640 let match;
641 - expect(() => (match = ReactNative.findNodeHandle(parent))).toWarnDev([
641 + expect(() => (match = ReactNative.findNodeHandle(parent))).toErrorDev([
642 'Warning: findNodeHandle is deprecated in StrictMode. ' +
643 'findNodeHandle was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
644 'Instead, add a ref directly to the element you want to reference. ' +
@@ -674,7 +674,7 @@ describe('ReactNative', () => {
674 );
675
676 let match;
677 - expect(() => (match = ReactNative.findNodeHandle(parent))).toWarnDev([
677 + expect(() => (match = ReactNative.findNodeHandle(parent))).toErrorDev([
678 'Warning: findNodeHandle is deprecated in StrictMode. ' +
679 'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
680 'Instead, add a ref directly to the element you want to reference. ' +
packages/react-reconciler/src/__tests__/ErrorBoundaryReconciliation-test.internal.js
+1 -1
@@ -68,7 +68,7 @@ describe('ErrorBoundaryReconciliation', () => {
68 </ErrorBoundary>,
69 );
70 Scheduler.unstable_flushAll();
71 - }).toWarnDev(isConcurrent ? ['invalid', 'invalid'] : ['invalid']);
71 + }).toErrorDev(isConcurrent ? ['invalid', 'invalid'] : ['invalid']);
72 const Fallback = fallbackTagName;
73 expect(renderer).toMatchRenderedOutput(<Fallback prop="ErrorBoundary" />);
74 }
packages/react-reconciler/src/__tests__/ReactFragment-test.js
+4 -4
@@ -708,7 +708,7 @@ describe('ReactFragment', () => {
708 expect(Scheduler).toFlushWithoutYielding();
709
710 ReactNoop.render(<Foo condition={false} />);
711 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
711 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
712 'Each child in a list should have a unique "key" prop.',
713 );
714
@@ -752,12 +752,12 @@ describe('ReactFragment', () => {
752 }
753
754 ReactNoop.render(<Foo condition={true} />);
755 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
755 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
756 'Each child in a list should have a unique "key" prop.',
757 );
758
759 ReactNoop.render(<Foo condition={false} />);
760 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
760 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
761 'Each child in a list should have a unique "key" prop.',
762 );
763
@@ -765,7 +765,7 @@ describe('ReactFragment', () => {
765 expect(ReactNoop.getChildren()).toEqual([span(), div()]);
766
767 ReactNoop.render(<Foo condition={true} />);
768 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
768 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
769 'Each child in a list should have a unique "key" prop.',
770 );
771
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
+29 -29
@@ -269,7 +269,7 @@ describe('ReactHooks', () => {
269 throw new Error('Expected to ignore the callback.');
270 }),
271 );
272 - }).toWarnDev(
272 + }).toErrorDev(
273 'State updates from the useState() and useReducer() Hooks ' +
274 "don't support the second callback argument. " +
275 'To execute a side effect after rendering, ' +
@@ -303,7 +303,7 @@ describe('ReactHooks', () => {
303 throw new Error('Expected to ignore the callback.');
304 }),
305 );
306 - }).toWarnDev(
306 + }).toErrorDev(
307 'State updates from the useState() and useReducer() Hooks ' +
308 "don't support the second callback argument. " +
309 'To execute a side effect after rendering, ' +
@@ -613,7 +613,7 @@ describe('ReactHooks', () => {
613 expect(Scheduler).toHaveYielded(['Did commit: A']);
614 expect(() => {
615 root.update(<App dependencies={['A', 'B']} />);
616 - }).toWarnDev([
616 + }).toErrorDev([
617 'Warning: The final argument passed to useLayoutEffect changed size ' +
618 'between renders. The order and size of this array must remain ' +
619 'constant.\n\n' +
@@ -639,7 +639,7 @@ describe('ReactHooks', () => {
639
640 expect(() => {
641 root.update(<App text="Hello" hasDeps={false} />);
642 - }).toWarnDev([
642 + }).toErrorDev([
643 'Warning: useMemo received a final argument during this render, but ' +
644 'not during the previous render. Even though the final argument is ' +
645 'optional, its type cannot change between renders.',
@@ -661,7 +661,7 @@ describe('ReactHooks', () => {
661 act(() => {
662 ReactTestRenderer.create(<App deps={'hello'} />);
663 });
664 - }).toWarnDev([
664 + }).toErrorDev([
665 'Warning: useEffect received a final argument that is not an array (instead, received `string`). ' +
666 'When specified, the final argument must be an array.',
667 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `string`). ' +
@@ -675,7 +675,7 @@ describe('ReactHooks', () => {
675 act(() => {
676 ReactTestRenderer.create(<App deps={100500} />);
677 });
678 - }).toWarnDev([
678 + }).toErrorDev([
679 'Warning: useEffect received a final argument that is not an array (instead, received `number`). ' +
680 'When specified, the final argument must be an array.',
681 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `number`). ' +
@@ -689,7 +689,7 @@ describe('ReactHooks', () => {
689 act(() => {
690 ReactTestRenderer.create(<App deps={{}} />);
691 });
692 - }).toWarnDev([
692 + }).toErrorDev([
693 'Warning: useEffect received a final argument that is not an array (instead, received `object`). ' +
694 'When specified, the final argument must be an array.',
695 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `object`). ' +
@@ -717,7 +717,7 @@ describe('ReactHooks', () => {
717
718 expect(() => {
719 ReactTestRenderer.create(<App deps={'hello'} />);
720 - }).toWarnDev([
720 + }).toErrorDev([
721 'Warning: useImperativeHandle received a final argument that is not an array (instead, received `string`). ' +
722 'When specified, the final argument must be an array.',
723 ]);
@@ -737,20 +737,20 @@ describe('ReactHooks', () => {
737 }
738
739 const root1 = ReactTestRenderer.create(null);
740 - expect(() => root1.update(<App return={17} />)).toWarnDev([
740 + expect(() => root1.update(<App return={17} />)).toErrorDev([
741 'Warning: An effect function must not return anything besides a ' +
742 'function, which is used for clean-up. You returned: 17',
743 ]);
744
745 const root2 = ReactTestRenderer.create(null);
746 - expect(() => root2.update(<App return={null} />)).toWarnDev([
746 + expect(() => root2.update(<App return={null} />)).toErrorDev([
747 'Warning: An effect function must not return anything besides a ' +
748 'function, which is used for clean-up. You returned null. If your ' +
749 'effect does not require clean up, return undefined (or nothing).',
750 ]);
751
752 const root3 = ReactTestRenderer.create(null);
753 - expect(() => root3.update(<App return={Promise.resolve()} />)).toWarnDev([
753 + expect(() => root3.update(<App return={Promise.resolve()} />)).toErrorDev([
754 'Warning: An effect function must not return anything besides a ' +
755 'function, which is used for clean-up.\n\n' +
756 'It looks like you wrote useEffect(async () => ...) or returned a Promise.',
@@ -845,7 +845,7 @@ describe('ReactHooks', () => {
845 expect(() => {
846 ReactTestRenderer.create(<App />);
847 }).toThrow('create is not a function');
848 - }).toWarnDev([
848 + }).toErrorDev([
849 'Expected useImperativeHandle() first argument to either be a ' +
850 'ref callback or React.createRef() object. ' +
851 'Instead received: an object with keys {focus}.',
@@ -865,7 +865,7 @@ describe('ReactHooks', () => {
865
866 expect(() => {
867 ReactTestRenderer.create(<App />);
868 - }).toWarnDev([
868 + }).toErrorDev([
869 'Expected useImperativeHandle() second argument to be a function ' +
870 'that creates a handle. Instead received: object.',
871 ]);
@@ -933,7 +933,7 @@ describe('ReactHooks', () => {
933 });
934 return null;
935 }
936 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev(
936 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev(
937 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks.',
938 );
939 });
@@ -951,7 +951,7 @@ describe('ReactHooks', () => {
951 }, []);
952 }
953
954 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev(
954 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev(
955 'Context can only be read while React is rendering',
956 );
957 });
@@ -973,7 +973,7 @@ describe('ReactHooks', () => {
973 }, []);
974 }
975
976 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev(
976 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev(
977 'Context can only be read while React is rendering',
978 );
979 expect(firstRead).toBe('light');
@@ -1044,7 +1044,7 @@ describe('ReactHooks', () => {
1044 return null;
1045 }
1046
1047 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev([
1047 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev([
1048 'Context can only be read while React is rendering',
1049 ]);
1050 });
@@ -1082,7 +1082,7 @@ describe('ReactHooks', () => {
1082 <Cls />
1083 </>,
1084 ),
1085 - ).toWarnDev(['Context can only be read while React is rendering']);
1085 + ).toErrorDev(['Context can only be read while React is rendering']);
1086 });
1087
1088 it('warns when calling hooks inside useReducer', () => {
@@ -1104,7 +1104,7 @@ describe('ReactHooks', () => {
1104 expect(() => {
1105 ReactTestRenderer.create(<App />);
1106 }).toThrow('Rendered more hooks than during the previous render.');
1107 - }).toWarnDev([
1107 + }).toErrorDev([
1108 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks',
1109 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks',
1110 'Warning: React has detected a change in the order of Hooks called by App. ' +
@@ -1127,7 +1127,7 @@ describe('ReactHooks', () => {
1127 });
1128 return null;
1129 }
1130 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev(
1130 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev(
1131 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks.',
1132 );
1133 });
@@ -1167,7 +1167,7 @@ describe('ReactHooks', () => {
1167 <App />
1168 </Boundary>,
1169 );
1170 - }).toWarnDev([
1170 + }).toErrorDev([
1171 // We see it twice due to replay
1172 'Context can only be read while React is rendering',
1173 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks',
@@ -1202,7 +1202,7 @@ describe('ReactHooks', () => {
1202 <App />
1203 </Boundary>,
1204 );
1205 - }).toWarnDev([
1205 + }).toErrorDev([
1206 // We see it twice due to replay
1207 'Context can only be read while React is rendering',
1208 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks',
@@ -1224,7 +1224,7 @@ describe('ReactHooks', () => {
1224 }, []);
1225 }
1226
1227 - expect(() => ReactTestRenderer.create(<App />)).toWarnDev(
1227 + expect(() => ReactTestRenderer.create(<App />)).toErrorDev(
1228 'Context can only be read while React is rendering',
1229 );
1230 });
@@ -1343,7 +1343,7 @@ describe('ReactHooks', () => {
1343 expect(renderCount).toBe(1);
1344
1345 renderCount = 0;
1346 - expect(() => renderer.update(<Factory />)).toWarnDev(
1346 + expect(() => renderer.update(<Factory />)).toErrorDev(
1347 'Warning: The <Factory /> component appears to be a function component that returns a class instance. ' +
1348 'Change Factory to a class that extends React.Component instead. ' +
1349 "If you can't use a class try assigning the prototype on the function as a workaround. " +
@@ -1557,7 +1557,7 @@ describe('ReactHooks', () => {
1557 // This is okay as far as this test is concerned.
1558 // We just want to verify that warnings are always logged.
1559 }
1560 - }).toWarnDev([
1560 + }).toErrorDev([
1561 'Warning: React has detected a change in the order of Hooks called by App. ' +
1562 'This will lead to bugs and errors if not fixed. For more information, ' +
1563 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
@@ -1608,7 +1608,7 @@ describe('ReactHooks', () => {
1608 // This is okay as far as this test is concerned.
1609 // We just want to verify that warnings are always logged.
1610 }
1611 - }).toWarnDev([
1611 + }).toErrorDev([
1612 'Warning: React has detected a change in the order of Hooks called by App. ' +
1613 'This will lead to bugs and errors if not fixed. For more information, ' +
1614 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
@@ -1688,7 +1688,7 @@ describe('ReactHooks', () => {
1688 // This is okay as far as this test is concerned.
1689 // We just want to verify that warnings are always logged.
1690 }
1691 - }).toWarnDev([
1691 + }).toErrorDev([
1692 'Warning: React has detected a change in the order of Hooks called by App. ' +
1693 'This will lead to bugs and errors if not fixed. For more information, ' +
1694 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
@@ -1730,7 +1730,7 @@ describe('ReactHooks', () => {
1730 expect(() => root.update(<App update={true} />)).toThrow(
1731 'custom error',
1732 );
1733 - }).toWarnDev([
1733 + }).toErrorDev([
1734 'Warning: React has detected a change in the order of Hooks called by App. ' +
1735 'This will lead to bugs and errors if not fixed. For more information, ' +
1736 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
@@ -1816,7 +1816,7 @@ describe('ReactHooks', () => {
1816 expect(() => {
1817 globalListener();
1818 globalListener();
1819 - }).toWarnDev([
1819 + }).toErrorDev([
1820 'An update to C inside a test was not wrapped in act',
1821 'An update to C inside a test was not wrapped in act',
1822 // Note: should *not* warn about updates on unmounted component.
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js
+8 -8
@@ -195,7 +195,7 @@ describe('ReactHooksWithNoopRenderer', () => {
195 '3. You might have more than one copy of React in the same app\n' +
196 'See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.',
197 ),
198 - ).toWarnDev(
198 + ).toErrorDev(
199 'Warning: The <Counter /> component appears to be a function component that returns a class instance. ' +
200 'Change Counter to a class that extends React.Component instead. ' +
201 "If you can't use a class try assigning the prototype on the function as a workaround. " +
@@ -319,7 +319,7 @@ describe('ReactHooksWithNoopRenderer', () => {
319 expect(Scheduler).toFlushWithoutYielding();
320 ReactNoop.render(null);
321 expect(Scheduler).toFlushWithoutYielding();
322 - expect(() => act(() => _updateCount(1))).toWarnDev(
322 + expect(() => act(() => _updateCount(1))).toErrorDev(
323 "Warning: Can't perform a React state update on an unmounted " +
324 'component. This is a no-op, but it indicates a memory leak in your ' +
325 'application. To fix, cancel all subscriptions and asynchronous ' +
@@ -986,7 +986,7 @@ describe('ReactHooksWithNoopRenderer', () => {
986 );
987 expect(Scheduler).toFlushAndYieldThrough(['Count: 0', 'Sync effect']);
988 expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);
989 - }).toWarnDev(['An update to Counter ran an effect']);
989 + }).toErrorDev(['An update to Counter ran an effect']);
990
991 // A discrete event forces the passive effect to be flushed --
992 // updateCount(1) happens first, so 2 wins.
@@ -1000,7 +1000,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1000 expect(Scheduler).toHaveYielded(['Will set count to 1']);
1001 expect(() => {
1002 expect(Scheduler).toFlushAndYield(['Count: 2']);
1003 - }).toWarnDev([
1003 + }).toErrorDev([
1004 'An update to Counter ran an effect',
1005 'An update to Counter ran an effect',
1006 ]);
@@ -1049,7 +1049,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1049 );
1050 expect(Scheduler).toFlushAndYieldThrough(['Count: 0', 'Sync effect']);
1051 expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);
1052 - }).toWarnDev(['An update to Counter ran an effect']);
1052 + }).toErrorDev(['An update to Counter ran an effect']);
1053
1054 expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(0);
1055
@@ -1065,7 +1065,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1065 expect(Scheduler).toHaveYielded(['Will set count to 1']);
1066 expect(() => {
1067 expect(Scheduler).toFlushAndYield(['Count: 2']);
1068 - }).toWarnDev([
1068 + }).toErrorDev([
1069 'An update to Counter ran an effect',
1070 'An update to Counter ran an effect',
1071 ]);
@@ -2271,7 +2271,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2271 expect(() => {
2272 expect(Scheduler).toFlushAndYield(['A: 2, B: 3, C: 0']);
2273 }).toThrow('Rendered more hooks than during the previous render');
2274 - }).toWarnDev([
2274 + }).toErrorDev([
2275 'Warning: React has detected a change in the order of Hooks called by App. ' +
2276 'This will lead to bugs and errors if not fixed. For more information, ' +
2277 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
@@ -2367,7 +2367,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2367 expect(() => {
2368 expect(Scheduler).toFlushAndYield([]);
2369 }).toThrow('Rendered more hooks than during the previous render');
2370 - }).toWarnDev([
2370 + }).toErrorDev([
2371 'Warning: React has detected a change in the order of Hooks called by App. ' +
2372 'This will lead to bugs and errors if not fixed. For more information, ' +
2373 'read the Rules of Hooks: https://fb.me/rules-of-hooks\n\n' +
packages/react-reconciler/src/__tests__/ReactIncremental-test.internal.js
+16 -16
@@ -1912,7 +1912,7 @@ describe('ReactIncremental', () => {
1912 'ShowLocale {"locale":"fr"}',
1913 'ShowBoth {"locale":"fr"}',
1914 ]),
1915 - ).toWarnDev(
1915 + ).toErrorDev(
1916 'Legacy context API has been detected within a strict-mode tree.\n\n' +
1917 'The old API will be supported in all 16.x releases, but applications ' +
1918 'using it should migrate to the new version.\n\n' +
@@ -1969,7 +1969,7 @@ describe('ReactIncremental', () => {
1969 'ShowBoth {"locale":"en","route":"/about"}',
1970 'ShowBoth {"locale":"en"}',
1971 ]),
1972 - ).toWarnDev(
1972 + ).toErrorDev(
1973 'Legacy context API has been detected within a strict-mode tree.\n\n' +
1974 'The old API will be supported in all 16.x releases, but applications ' +
1975 'using it should migrate to the new version.\n\n' +
@@ -2000,7 +2000,7 @@ describe('ReactIncremental', () => {
2000 }
2001
2002 ReactNoop.render(<Recurse />);
2003 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2003 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2004 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2005 'The old API will be supported in all 16.x releases, but applications ' +
2006 'using it should migrate to the new version.\n\n' +
@@ -2039,7 +2039,7 @@ describe('ReactIncremental', () => {
2039 };
2040
2041 ReactNoop.render(<Recurse />);
2042 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2042 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2043 [
2044 'Warning: The <Recurse /> component appears to be a function component that returns a class instance. ' +
2045 'Change Recurse to a class that extends React.Component instead. ' +
@@ -2113,7 +2113,7 @@ describe('ReactIncremental', () => {
2113 'Intl {}',
2114 'ShowLocale {"locale":"ru"}',
2115 ]),
2116 - ).toWarnDev(
2116 + ).toErrorDev(
2117 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2118 'The old API will be supported in all 16.x releases, but applications ' +
2119 'using it should migrate to the new version.\n\n' +
@@ -2194,7 +2194,7 @@ describe('ReactIncremental', () => {
2194 </IndirectionFn>
2195 </Intl>,
2196 );
2197 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2197 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2198 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2199 'The old API will be supported in all 16.x releases, but applications ' +
2200 'using it should migrate to the new version.\n\n' +
@@ -2288,7 +2288,7 @@ describe('ReactIncremental', () => {
2288 </IndirectionFn>
2289 </Stateful>,
2290 );
2291 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2291 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2292 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2293 'The old API will be supported in all 16.x releases, but applications ' +
2294 'using it should migrate to the new version.\n\n' +
@@ -2359,7 +2359,7 @@ describe('ReactIncremental', () => {
2359
2360 // Init
2361 ReactNoop.render(<Root />);
2362 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2362 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2363 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2364 'The old API will be supported in all 16.x releases, but applications ' +
2365 'using it should migrate to the new version.\n\n' +
@@ -2411,7 +2411,7 @@ describe('ReactIncremental', () => {
2411
2412 // Init
2413 ReactNoop.render(<Root />);
2414 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2414 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2415 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2416 'The old API will be supported in all 16.x releases, but applications ' +
2417 'using it should migrate to the new version.\n\n' +
@@ -2424,7 +2424,7 @@ describe('ReactIncremental', () => {
2424 instance.setState({
2425 throwError: true,
2426 });
2427 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2427 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2428 'Error boundaries should implement getDerivedStateFromError()',
2429 );
2430 });
@@ -2461,7 +2461,7 @@ describe('ReactIncremental', () => {
2461 }
2462
2463 ReactNoop.render(<MyComponent />);
2464 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2464 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2465 [
2466 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended',
2467 'Legacy context API has been detected within a strict-mode tree.\n\n' +
@@ -2612,7 +2612,7 @@ describe('ReactIncremental', () => {
2612 </TopContextProvider>,
2613 );
2614
2615 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2615 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2616 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2617 'The old API will be supported in all 16.x releases, but applications ' +
2618 'using it should migrate to the new version.\n\n' +
@@ -2676,7 +2676,7 @@ describe('ReactIncremental', () => {
2676 </TopContextProvider>,
2677 );
2678
2679 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2679 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2680 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2681 'The old API will be supported in all 16.x releases, but applications ' +
2682 'using it should migrate to the new version.\n\n' +
@@ -2749,7 +2749,7 @@ describe('ReactIncremental', () => {
2749 </TopContextProvider>,
2750 );
2751
2752 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2752 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2753 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2754 'The old API will be supported in all 16.x releases, but applications ' +
2755 'using it should migrate to the new version.\n\n' +
@@ -2832,7 +2832,7 @@ describe('ReactIncremental', () => {
2832 </TopContextProvider>,
2833 );
2834
2835 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
2835 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
2836 'Legacy context API has been detected within a strict-mode tree.\n\n' +
2837 'The old API will be supported in all 16.x releases, but applications ' +
2838 'using it should migrate to the new version.\n\n' +
@@ -2938,7 +2938,7 @@ describe('ReactIncremental', () => {
2938 ReactNoop.render(<Boundary />);
2939 expect(() => {
2940 expect(Scheduler).toFlushWithoutYielding();
2941 - }).toWarnDev(
2941 + }).toErrorDev(
2942 ['Legacy context API has been detected within a strict-mode tree'],
2943 {withoutStack: true},
2944 );
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
+5 -5
@@ -1148,7 +1148,7 @@ describe('ReactIncrementalErrorHandling', () => {
1148 <Connector />
1149 </Provider>,
1150 );
1151 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1151 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1152 'Legacy context API has been detected within a strict-mode tree.\n\n' +
1153 'The old API will be supported in all 16.x releases, but ' +
1154 'applications using it should migrate to the new version.\n\n' +
@@ -1183,7 +1183,7 @@ describe('ReactIncrementalErrorHandling', () => {
1183 <BrokenRender />
1184 </ErrorBoundary>,
1185 );
1186 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev([
1186 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev([
1187 'Warning: React.createElement: type is invalid -- expected a string',
1188 // React retries once on error
1189 'Warning: React.createElement: type is invalid -- expected a string',
@@ -1232,7 +1232,7 @@ describe('ReactIncrementalErrorHandling', () => {
1232 <BrokenRender fail={true} />
1233 </ErrorBoundary>,
1234 );
1235 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev([
1235 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev([
1236 'Warning: React.createElement: type is invalid -- expected a string',
1237 // React retries once on error
1238 'Warning: React.createElement: type is invalid -- expected a string',
@@ -1252,7 +1252,7 @@ describe('ReactIncrementalErrorHandling', () => {
1252
1253 it('recovers from uncaught reconciler errors', () => {
1254 const InvalidType = undefined;
1255 - expect(() => ReactNoop.render(<InvalidType />)).toWarnDev(
1255 + expect(() => ReactNoop.render(<InvalidType />)).toErrorDev(
1256 'Warning: React.createElement: type is invalid -- expected a string',
1257 {withoutStack: true},
1258 );
@@ -1645,7 +1645,7 @@ describe('ReactIncrementalErrorHandling', () => {
1645 ReactNoop.render(<Provider />);
1646 expect(() => {
1647 expect(Scheduler).toFlushAndThrow('Oops!');
1648 - }).toWarnDev(
1648 + }).toErrorDev(
1649 [
1650 'Warning: The <Provider /> component appears to be a function component that returns a class instance. ' +
1651 'Change Provider to a class that extends React.Component instead. ' +
packages/react-reconciler/src/__tests__/ReactIncrementalErrorLogging-test.js
+1 -1
@@ -22,7 +22,7 @@ describe('ReactIncrementalErrorLogging', () => {
22 Scheduler = require('scheduler');
23 });
24
25 - // Note: in this test file we won't be using toWarnDev() matchers
25 + // Note: in this test file we won't be using toErrorDev() matchers
26 // because they filter out precisely the messages we want to test for.
27 let oldConsoleError;
28 beforeEach(() => {
packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js
+2 -2
@@ -324,7 +324,7 @@ describe('ReactDebugFiberPerf', () => {
324 </Parent>,
325 );
326 addComment('Should not print a warning');
327 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
327 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
328 [
329 'Using UNSAFE_componentWillMount in strict mode is not recommended',
330 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended',
@@ -364,7 +364,7 @@ describe('ReactDebugFiberPerf', () => {
364 }
365 ReactNoop.render(<AllLifecycles />);
366 addComment('Mount');
367 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
367 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
368 [
369 'Using UNSAFE_componentWillMount in strict mode is not recommended',
370 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended',
packages/react-reconciler/src/__tests__/ReactIncrementalReflection-test.internal.js
+3 -3
@@ -75,7 +75,7 @@ describe('ReactIncrementalReflection', () => {
75 // Render the rest and commit the updates.
76 expect(() =>
77 expect(Scheduler).toFlushAndYield(['componentDidMount: true']),
78 - ).toWarnDev(
78 + ).toErrorDev(
79 'Using UNSAFE_componentWillMount in strict mode is not recommended',
80 {withoutStack: true},
81 );
@@ -114,7 +114,7 @@ describe('ReactIncrementalReflection', () => {
114 }
115
116 ReactNoop.render(<Foo mount={true} />);
117 - expect(() => expect(Scheduler).toFlushAndYield(['Component'])).toWarnDev(
117 + expect(() => expect(Scheduler).toFlushAndYield(['Component'])).toErrorDev(
118 'Using UNSAFE_componentWillMount in strict mode is not recommended',
119 {withoutStack: true},
120 );
@@ -219,7 +219,7 @@ describe('ReactIncrementalReflection', () => {
219
220 expect(() =>
221 expect(Scheduler).toFlushAndYield([['componentDidMount', span()]]),
222 - ).toWarnDev(
222 + ).toErrorDev(
223 [
224 'Using UNSAFE_componentWillMount in strict mode is not recommended',
225 'Using UNSAFE_componentWillUpdate in strict mode is not recommended',
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.internal.js
+2 -2
@@ -1201,7 +1201,7 @@ describe('ReactIncrementalSideEffects', () => {
1201 }
1202
1203 ReactNoop.render(<Foo show={true} />);
1204 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1204 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1205 'Warning: Function components cannot be given refs. ' +
1206 'Attempts to access this ref will fail. ' +
1207 'Did you mean to use React.forwardRef()?\n\n' +
@@ -1265,7 +1265,7 @@ describe('ReactIncrementalSideEffects', () => {
1265 }
1266
1267 ReactNoop.render(<Foo />);
1268 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1268 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1269 'Warning: A string ref, "bar", has been found within a strict mode tree.',
1270 );
1271
packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.internal.js
+2 -2
@@ -345,7 +345,7 @@ describe('ReactIncrementalUpdates', () => {
345 }
346 }
347 ReactNoop.render(<Foo />);
348 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
348 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
349 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended',
350 {withoutStack: true},
351 );
@@ -383,7 +383,7 @@ describe('ReactIncrementalUpdates', () => {
383 return {a: 'a'};
384 });
385
386 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
386 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
387 'An update (setState, replaceState, or forceUpdate) was scheduled ' +
388 'from inside an update function. Update functions should be pure, ' +
389 'with zero side-effects. Consider using componentDidUpdate or a ' +
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+9 -9
@@ -525,7 +525,7 @@ describe('ReactLazy', () => {
525 const LazyText = lazy(() => fakeImport(T));
526 expect(() => {
527 LazyText.defaultProps = {outer: 'Bye'};
528 - }).toWarnDev(
528 + }).toErrorDev(
529 'React.lazy(...): It is not supported to assign `defaultProps` to ' +
530 'a lazy component import. Either specify them where the component ' +
531 'is defined, or create a wrapping component around it.',
@@ -626,7 +626,7 @@ describe('ReactLazy', () => {
626 const LazyText = lazy(() => fakeImport(Text));
627 expect(() => {
628 LazyText.propTypes = {hello: () => {}};
629 - }).toWarnDev(
629 + }).toErrorDev(
630 'React.lazy(...): It is not supported to assign `propTypes` to ' +
631 'a lazy component import. Either specify them where the component ' +
632 'is defined, or create a wrapping component around it.',
@@ -638,7 +638,7 @@ describe('ReactLazy', () => {
638 const LazyAdd = lazy(() => fakeImport(Add));
639 expect(() => {
640 LazyAdd.propTypes = {};
641 - }).toWarnDev(
641 + }).toErrorDev(
642 'React.lazy(...): It is not supported to assign `propTypes` to ' +
643 'a lazy component import. Either specify them where the component ' +
644 'is defined, or create a wrapping component around it.',
@@ -661,7 +661,7 @@ describe('ReactLazy', () => {
661 await Promise.resolve();
662 expect(() => {
663 Scheduler.unstable_flushAll();
664 - }).toWarnDev([
664 + }).toErrorDev([
665 'Invalid prop `inner` of type `string` supplied to `Add`, expected `number`.',
666 ]);
667 expect(root).toMatchRenderedOutput('22');
@@ -674,7 +674,7 @@ describe('ReactLazy', () => {
674 </Suspense>,
675 );
676 expect(Scheduler).toFlushWithoutYielding();
677 - }).toWarnDev(
677 + }).toErrorDev(
678 'Invalid prop `inner` of type `boolean` supplied to `Add`, expected `number`.',
679 );
680 expect(root).toMatchRenderedOutput('0');
@@ -846,7 +846,7 @@ describe('ReactLazy', () => {
846 await Promise.resolve();
847 expect(() => {
848 expect(Scheduler).toFlushAndYield(['Inner default text']);
849 - }).toWarnDev(
849 + }).toErrorDev(
850 'The prop `text` is marked as required in `T`, but its value is `undefined`',
851 );
852 expect(root).toMatchRenderedOutput('Inner default text');
@@ -859,7 +859,7 @@ describe('ReactLazy', () => {
859 </Suspense>,
860 );
861 expect(Scheduler).toFlushAndYield([null]);
862 - }).toWarnDev(
862 + }).toErrorDev(
863 'The prop `text` is marked as required in `T`, but its value is `null`',
864 );
865 expect(root).toMatchRenderedOutput(null);
@@ -888,7 +888,7 @@ describe('ReactLazy', () => {
888
889 expect(() => {
890 expect(Scheduler).toFlushAndYield(['A', 'B']);
891 - }).toWarnDev(' in Text (at **)\n' + ' in Foo (at **)');
891 + }).toErrorDev(' in Text (at **)\n' + ' in Foo (at **)');
892 expect(root).toMatchRenderedOutput(<div>AB</div>);
893 });
894
@@ -1086,6 +1086,6 @@ describe('ReactLazy', () => {
1086 await Promise.resolve();
1087 expect(() => {
1088 expect(Scheduler).toFlushAndYield([]);
1089 - }).toWarnDev('Function components cannot be given refs');
1089 + }).toErrorDev('Function components cannot be given refs');
1090 });
1091 });
packages/react-reconciler/src/__tests__/ReactMemo-test.internal.js
+10 -10
@@ -56,7 +56,7 @@ describe('memo', () => {
56 return <App ref={() => {}} />;
57 }
58 ReactNoop.render(<Outer />);
59 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev([
59 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev([
60 'Warning: Function components cannot be given refs. Attempts to access ' +
61 'this ref will fail.',
62 ]);
@@ -74,7 +74,7 @@ describe('memo', () => {
74 return <App ref={() => {}} />;
75 }
76 ReactNoop.render(<Outer />);
77 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev([
77 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev([
78 'Warning: Function components cannot be given refs. Attempts to access ' +
79 'this ref will fail.',
80 ]);
@@ -311,7 +311,7 @@ describe('memo', () => {
311 });
312
313 it('warns if the first argument is undefined', () => {
314 - expect(() => memo()).toWarnDev(
314 + expect(() => memo()).toErrorDev(
315 'memo: The first argument must be a component. Instead ' +
316 'received: undefined',
317 {withoutStack: true},
@@ -319,7 +319,7 @@ describe('memo', () => {
319 });
320
321 it('warns if the first argument is null', () => {
322 - expect(() => memo(null)).toWarnDev(
322 + expect(() => memo(null)).toErrorDev(
323 'memo: The first argument must be a component. Instead ' +
324 'received: null',
325 {withoutStack: true},
@@ -337,7 +337,7 @@ describe('memo', () => {
337 expect(() => {
338 ReactNoop.render(<Fn inner="2" />);
339 expect(Scheduler).toFlushWithoutYielding();
340 - }).toWarnDev(
340 + }).toErrorDev(
341 'Invalid prop `inner` of type `string` supplied to `FnInner`, expected `number`.',
342 );
343
@@ -345,7 +345,7 @@ describe('memo', () => {
345 expect(() => {
346 ReactNoop.render(<Fn inner={false} />);
347 expect(Scheduler).toFlushWithoutYielding();
348 - }).toWarnDev(
348 + }).toErrorDev(
349 'Invalid prop `inner` of type `boolean` supplied to `FnInner`, expected `number`.',
350 );
351 });
@@ -361,7 +361,7 @@ describe('memo', () => {
361 expect(() => {
362 ReactNoop.render(<Fn outer="3" />);
363 expect(Scheduler).toFlushWithoutYielding();
364 - }).toWarnDev(
364 + }).toErrorDev(
365 // Outer props are checked in createElement
366 'Invalid prop `outer` of type `string` supplied to `FnInner`, expected `number`.',
367 );
@@ -370,7 +370,7 @@ describe('memo', () => {
370 expect(() => {
371 ReactNoop.render(<Fn outer={false} />);
372 expect(Scheduler).toFlushWithoutYielding();
373 - }).toWarnDev(
373 + }).toErrorDev(
374 // Outer props are checked in createElement
375 'Invalid prop `outer` of type `boolean` supplied to `FnInner`, expected `number`.',
376 );
@@ -397,7 +397,7 @@ describe('memo', () => {
397 expect(() => {
398 ReactNoop.render(<Outer inner="2" middle="3" outer="4" />);
399 expect(Scheduler).toFlushWithoutYielding();
400 - }).toWarnDev([
400 + }).toErrorDev([
401 'Invalid prop `outer` of type `string` supplied to `Inner`, expected `number`.',
402 'Invalid prop `middle` of type `string` supplied to `Inner`, expected `number`.',
403 'Invalid prop `inner` of type `string` supplied to `Inner`, expected `number`.',
@@ -409,7 +409,7 @@ describe('memo', () => {
409 <Outer inner={false} middle={false} outer={false} />,
410 );
411 expect(Scheduler).toFlushWithoutYielding();
412 - }).toWarnDev([
412 + }).toErrorDev([
413 'Invalid prop `outer` of type `boolean` supplied to `Inner`, expected `number`.',
414 'Invalid prop `middle` of type `boolean` supplied to `Inner`, expected `number`.',
415 'Invalid prop `inner` of type `boolean` supplied to `Inner`, expected `number`.',
packages/react-reconciler/src/__tests__/ReactNewContext-test.internal.js
+12 -12
@@ -56,7 +56,7 @@ describe('ReactNewContext', () => {
56 let contextValue;
57 expect(() => {
58 contextValue = useContext(Context, observedBits);
59 - }).toWarnDev(
59 + }).toErrorDev(
60 observedBits !== undefined
61 ? 'useContext() second argument is reserved for future use in React. ' +
62 `Passing it is not supported. You passed: ${observedBits}.`
@@ -72,7 +72,7 @@ describe('ReactNewContext', () => {
72 let contextValue;
73 expect(() => {
74 contextValue = useContext(Context, observedBits);
75 - }).toWarnDev(
75 + }).toErrorDev(
76 observedBits !== undefined
77 ? 'useContext() second argument is reserved for future use in React. ' +
78 `Passing it is not supported. You passed: ${observedBits}.`
@@ -88,7 +88,7 @@ describe('ReactNewContext', () => {
88 let contextValue;
89 expect(() => {
90 contextValue = useContext(Context, observedBits);
91 - }).toWarnDev(
91 + }).toErrorDev(
92 observedBits !== undefined
93 ? 'useContext() second argument is reserved for future use in React. ' +
94 `Passing it is not supported. You passed: ${observedBits}.`
@@ -1068,7 +1068,7 @@ describe('ReactNewContext', () => {
1068
1069 // Update
1070 ReactNoop.render(<App value={2} />);
1071 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1071 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1072 'calculateChangedBits: Expected the return value to be a 31-bit ' +
1073 'integer. Instead received: 4294967295',
1074 );
@@ -1195,7 +1195,7 @@ describe('ReactNewContext', () => {
1195 );
1196 expect(() => {
1197 expect(Scheduler).toFlushAndYield(['LegacyProvider', 'App', 'Child']);
1198 - }).toWarnDev(
1198 + }).toErrorDev(
1199 'Legacy context API has been detected within a strict-mode tree.\n\n' +
1200 'The old API will be supported in all 16.x releases, but applications ' +
1201 'using it should migrate to the new version.\n\n' +
@@ -1481,7 +1481,7 @@ describe('ReactNewContext', () => {
1481 }
1482
1483 ReactNoop.render(<Cls />);
1484 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev([
1484 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev([
1485 'Context can only be read while React is rendering',
1486 'Cannot update during an existing state transition',
1487 ]);
@@ -1495,7 +1495,7 @@ describe('ReactNewContext', () => {
1495 return [Context].map(useContext);
1496 }
1497 ReactNoop.render(<Foo />);
1498 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1498 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1499 'useContext() second argument is reserved for future ' +
1500 'use in React. Passing it is not supported. ' +
1501 'You passed: 0.\n\n' +
@@ -1529,7 +1529,7 @@ describe('ReactNewContext', () => {
1529 return useContext(Context.Consumer);
1530 }
1531 ReactNoop.render(<Foo />);
1532 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1532 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1533 'Calling useContext(Context.Consumer) is not supported, may cause bugs, ' +
1534 'and will be removed in a future major release. ' +
1535 'Did you mean to call useContext(Context) instead?',
@@ -1543,7 +1543,7 @@ describe('ReactNewContext', () => {
1543 return null;
1544 }
1545 ReactNoop.render(<Foo />);
1546 - expect(() => expect(Scheduler).toFlushWithoutYielding()).toWarnDev(
1546 + expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1547 'Calling useContext(Context.Provider) is not supported. ' +
1548 'Did you mean to call useContext(Context) instead?',
1549 );
@@ -1844,7 +1844,7 @@ Context fuzz tester error! Copy and paste the following line into the test suite
1844 expect(() => {
1845 ReactNoop.render(<Component />);
1846 expect(Scheduler).toFlushWithoutYielding();
1847 - }).toWarnDev(
1847 + }).toErrorDev(
1848 'Rendering <Context> directly is not supported and will be removed in ' +
1849 'a future major release. Did you mean to render <Context.Consumer> instead?',
1850 );
@@ -1891,7 +1891,7 @@ Context fuzz tester error! Copy and paste the following line into the test suite
1891 expect(() => {
1892 ReactNoop.render(<Component />);
1893 expect(Scheduler).toFlushWithoutYielding();
1894 - }).toWarnDev(
1894 + }).toErrorDev(
1895 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' +
1896 'a future major release. Did you mean to render <Context.Consumer> instead?',
1897 );
@@ -1915,7 +1915,7 @@ Context fuzz tester error! Copy and paste the following line into the test suite
1915 expect(() => {
1916 ReactNoop.render(<Component />);
1917 expect(Scheduler).toFlushWithoutYielding();
1918 - }).toWarnDev(
1918 + }).toErrorDev(
1919 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' +
1920 'a future major release. Did you mean to render <Context.Provider> instead?',
1921 );
packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.internal.js
+2 -2
@@ -60,7 +60,7 @@ describe('ReactSuspense', () => {
60 );
61
62 ReactNoop.render(elementBadType);
63 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
63 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
64 'Warning: Unexpected type for suspenseCallback.',
65 ]);
66
@@ -71,7 +71,7 @@ describe('ReactSuspense', () => {
71 );
72
73 ReactNoop.render(elementMissingCallback);
74 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([]);
74 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([]);
75 });
76
77 it('1 then 0 suspense callback', () => {
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.internal.js
+8 -8
@@ -58,7 +58,7 @@ describe('ReactSuspenseList', () => {
58
59 ReactNoop.render(<Foo />);
60
61 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
61 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
62 'Warning: "something" is not a supported revealOrder on ' +
63 '<SuspenseList />. Did you mean "together", "forwards" or "backwards"?' +
64 '\n in SuspenseList (at **)' +
@@ -77,7 +77,7 @@ describe('ReactSuspenseList', () => {
77
78 ReactNoop.render(<Foo />);
79
80 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
80 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
81 'Warning: "TOGETHER" is not a valid value for revealOrder on ' +
82 '<SuspenseList />. Use lowercase "together" instead.' +
83 '\n in SuspenseList (at **)' +
@@ -96,7 +96,7 @@ describe('ReactSuspenseList', () => {
96
97 ReactNoop.render(<Foo />);
98
99 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
99 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
100 'Warning: "forward" is not a valid value for revealOrder on ' +
101 '<SuspenseList />. React uses the -s suffix in the spelling. ' +
102 'Use "forwards" instead.' +
@@ -128,7 +128,7 @@ describe('ReactSuspenseList', () => {
128 </Foo>,
129 );
130
131 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
131 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
132 'Warning: A single row was passed to a <SuspenseList revealOrder="forwards" />. ' +
133 'This is not useful since it needs multiple rows. ' +
134 'Did you mean to pass multiple children or an array?' +
@@ -148,7 +148,7 @@ describe('ReactSuspenseList', () => {
148
149 ReactNoop.render(<Foo />);
150
151 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
151 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
152 'Warning: A single row was passed to a <SuspenseList revealOrder="backwards" />. ' +
153 'This is not useful since it needs multiple rows. ' +
154 'Did you mean to pass multiple children or an array?' +
@@ -173,7 +173,7 @@ describe('ReactSuspenseList', () => {
173
174 ReactNoop.render(<Foo items={['A', 'B']} />);
175
176 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
176 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
177 'Warning: A nested array was passed to row #0 in <SuspenseList />. ' +
178 'Wrap it in an additional SuspenseList to configure its revealOrder: ' +
179 '<SuspenseList revealOrder=...> ... ' +
@@ -1354,7 +1354,7 @@ describe('ReactSuspenseList', () => {
1354
1355 ReactNoop.render(<Foo />);
1356
1357 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
1357 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
1358 'Warning: "collapse" is not a supported value for tail on ' +
1359 '<SuspenseList />. Did you mean "collapsed" or "hidden"?' +
1360 '\n in SuspenseList (at **)' +
@@ -1373,7 +1373,7 @@ describe('ReactSuspenseList', () => {
1373
1374 ReactNoop.render(<Foo />);
1375
1376 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
1376 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
1377 'Warning: <SuspenseList tail="collapsed" /> is only valid if ' +
1378 'revealOrder is "forwards" or "backwards". ' +
1379 'Did you mean to specify revealOrder="forwards"?' +
packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js
+4 -4
@@ -103,7 +103,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
103
104 ReactNoop.render(<Foo />);
105
106 - expect(() => Scheduler.unstable_flushAll()).toWarnDev([
106 + expect(() => Scheduler.unstable_flushAll()).toErrorDev([
107 'Warning: maxDuration has been removed from React. ' +
108 'Remove the maxDuration prop.' +
109 '\n in Suspense (at **)' +
@@ -1898,7 +1898,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1898 () => _setShow(true),
1899 );
1900 });
1901 - }).toWarnDev(
1901 + }).toErrorDev(
1902 'Warning: App triggered a user-blocking update that suspended.' + '\n\n',
1903 {withoutStack: true},
1904 );
@@ -1930,7 +1930,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1930 () => show(),
1931 );
1932 });
1933 - }).toWarnDev(
1933 + }).toErrorDev(
1934 'Warning: App triggered a user-blocking update that suspended.' + '\n\n',
1935 {withoutStack: true},
1936 );
@@ -1997,7 +1997,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
1997 () => _setShow(true),
1998 );
1999 });
2000 - }).toWarnDev(
2000 + }).toErrorDev(
2001 'Warning: A triggered a user-blocking update that suspended.' + '\n\n',
2002 {withoutStack: true},
2003 );
packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
+1 -1
@@ -1317,7 +1317,7 @@ describe('ReactFreshIntegration', () => {
1317
1318 export default Parent;
1319 `);
1320 - }).toWarnDev(
1320 + }).toErrorDev(
1321 'The <Parent /> component appears to be a function component ' +
1322 'that returns a class instance.',
1323 );
packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js
+4 -4
@@ -1195,7 +1195,7 @@ describe('ReactShallowRenderer', () => {
1195 }
1196
1197 const shallowRenderer = createRenderer();
1198 - expect(() => shallowRenderer.render(<SimpleComponent />)).toWarnDev(
1198 + expect(() => shallowRenderer.render(<SimpleComponent />)).toErrorDev(
1199 'Warning: Failed context type: The context `name` is marked as ' +
1200 'required in `SimpleComponent`, but its value is `undefined`.\n' +
1201 ' in SimpleComponent (at **)',
@@ -1216,7 +1216,7 @@ describe('ReactShallowRenderer', () => {
1216 const shallowRenderer = createRenderer();
1217 expect(() =>
1218 shallowRenderer.render(React.createElement(SimpleComponent, {name: 123})),
1219 - ).toWarnDev(
1219 + ).toErrorDev(
1220 'Warning: Failed prop type: Invalid prop `name` of type `number` ' +
1221 'supplied to `SimpleComponent`, expected `string`.\n' +
1222 ' in SimpleComponent',
@@ -1344,7 +1344,7 @@ describe('ReactShallowRenderer', () => {
1344
1345 const renderAndVerifyWarningAndError = (Component, typeString) => {
1346 expect(() => {
1347 - expect(() => shallowRenderer.render(<Component />)).toWarnDev(
1347 + expect(() => shallowRenderer.render(<Component />)).toErrorDev(
1348 'React.createElement: type is invalid -- expected a string ' +
1349 '(for built-in components) or a class/function (for composite components) ' +
1350 `but got: ${typeString}.`,
@@ -1555,7 +1555,7 @@ describe('ReactShallowRenderer', () => {
1555 expect(() => {
1556 const SomeComponent = React.forwardRef(SomeMemoComponent);
1557 shallowRenderer.render(<SomeComponent ref={testRef} />);
1558 - }).toWarnDev(
1558 + }).toErrorDev(
1559 'Warning: forwardRef requires a render function but received ' +
1560 'a `memo` component. Instead of forwardRef(memo(...)), use ' +
1561 'memo(forwardRef(...))',
packages/react-test-renderer/src/__tests__/ReactShallowRendererMemo-test.js
+3 -3
@@ -1242,7 +1242,7 @@ describe('ReactShallowRendererMemo', () => {
1242 );
1243
1244 const shallowRenderer = createRenderer();
1245 - expect(() => shallowRenderer.render(<SimpleComponent />)).toWarnDev(
1245 + expect(() => shallowRenderer.render(<SimpleComponent />)).toErrorDev(
1246 'Warning: Failed context type: The context `name` is marked as ' +
1247 'required in `SimpleComponent`, but its value is `undefined`.\n' +
1248 ' in SimpleComponent (at **)',
@@ -1265,7 +1265,7 @@ describe('ReactShallowRendererMemo', () => {
1265 const shallowRenderer = createRenderer();
1266 expect(() =>
1267 shallowRenderer.render(React.createElement(SimpleComponent, {name: 123})),
1268 - ).toWarnDev(
1268 + ).toErrorDev(
1269 'Warning: Failed prop type: Invalid prop `name` of type `number` ' +
1270 'supplied to `SimpleComponent`, expected `string`.\n' +
1271 ' in SimpleComponent',
@@ -1401,7 +1401,7 @@ describe('ReactShallowRendererMemo', () => {
1401
1402 const renderAndVerifyWarningAndError = (Component, typeString) => {
1403 expect(() => {
1404 - expect(() => shallowRenderer.render(<Component />)).toWarnDev(
1404 + expect(() => shallowRenderer.render(<Component />)).toErrorDev(
1405 'React.createElement: type is invalid -- expected a string ' +
1406 '(for built-in components) or a class/function (for composite components) ' +
1407 `but got: ${typeString}.`,
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
+1 -1
@@ -281,7 +281,7 @@ describe('ReactTestRenderer', () => {
281 }
282 }
283 ReactTestRenderer.create(<Baz />);
284 - expect(() => ReactTestRenderer.create(<Foo />)).toWarnDev(
284 + expect(() => ReactTestRenderer.create(<Foo />)).toErrorDev(
285 'Warning: Function components cannot be given refs. Attempts ' +
286 'to access this ref will fail. ' +
287 'Did you mean to use React.forwardRef()?\n\n' +
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.js
+1 -1
@@ -34,7 +34,7 @@ describe('ReactTestRenderer', () => {
34 expect(() => {
35 ReactTestRenderer.create(ReactDOM.createPortal('foo', container));
36 }).toThrow();
37 - }).toWarnDev('An invalid container has been provided.', {
37 + }).toErrorDev('An invalid container has been provided.', {
38 withoutStack: true,
39 });
40 });
packages/react-test-renderer/src/__tests__/ReactTestRendererAct-test.js
+1 -1
@@ -50,7 +50,7 @@ describe('ReactTestRenderer.act()', () => {
50
51 expect(() => {
52 setCtr(1);
53 - }).toWarnDev([
53 + }).toErrorDev([
54 'An update to App inside a test was not wrapped in act(...)',
55 ]);
56 });
packages/react/src/__tests__/ReactChildren-test.js
+3 -3
@@ -319,7 +319,7 @@ describe('ReactChildren', () => {
319 });
320
321 let instance;
322 - expect(() => (instance = <div>{threeDivIterable}</div>)).toWarnDev(
322 + expect(() => (instance = <div>{threeDivIterable}</div>)).toErrorDev(
323 'Warning: Each child in a list should have a unique "key" prop.',
324 );
325
@@ -903,7 +903,7 @@ describe('ReactChildren', () => {
903
904 expect(() =>
905 ReactTestUtils.renderIntoDocument(<ComponentReturningArray />),
906 - ).toWarnDev(
906 + ).toErrorDev(
907 'Warning: ' +
908 'Each child in a list should have a unique "key" prop.' +
909 ' See https://fb.me/react-warning-keys for more information.' +
@@ -924,7 +924,7 @@ describe('ReactChildren', () => {
924 it('warns for keys for arrays at the top level', () => {
925 expect(() =>
926 ReactTestUtils.renderIntoDocument([<div />, <div />]),
927 - ).toWarnDev(
927 + ).toErrorDev(
928 'Warning: ' +
929 'Each child in a list should have a unique "key" prop.' +
930 ' See https://fb.me/react-warning-keys for more information.',
packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee
+12 -12
@@ -51,7 +51,7 @@ describe 'ReactCoffeeScriptClass', ->
51 expect(->
52 ReactDOM.render React.createElement(Foo), container
53 ).toThrow()
54 - ).toWarnDev([
54 + ).toErrorDev([
55 # A failed component renders twice in DEV
56 'No `render` method found on the returned component instance',
57 'No `render` method found on the returned component instance',
@@ -126,7 +126,7 @@ describe 'ReactCoffeeScriptClass', ->
126 {}
127 expect(->
128 ReactDOM.render(React.createElement(Foo, foo: 'foo'), container)
129 - ).toWarnDev 'Foo: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.'
129 + ).toErrorDev 'Foo: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.'
130 undefined
131
132 it 'warns if getDerivedStateFromError is not static', ->
@@ -137,7 +137,7 @@ describe 'ReactCoffeeScriptClass', ->
137 {}
138 expect(->
139 ReactDOM.render(React.createElement(Foo, foo: 'foo'), container)
140 - ).toWarnDev 'Foo: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.'
140 + ).toErrorDev 'Foo: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.'
141 undefined
142
143 it 'warns if getSnapshotBeforeUpdate is static', ->
@@ -148,7 +148,7 @@ describe 'ReactCoffeeScriptClass', ->
148 {}
149 expect(->
150 ReactDOM.render(React.createElement(Foo, foo: 'foo'), container)
151 - ).toWarnDev 'Foo: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.'
151 + ).toErrorDev 'Foo: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.'
152 undefined
153
154 it 'warns if state not initialized before static getDerivedStateFromProps', ->
@@ -163,7 +163,7 @@ describe 'ReactCoffeeScriptClass', ->
163 }
164 expect(->
165 ReactDOM.render(React.createElement(Foo, foo: 'foo'), container)
166 - ).toWarnDev (
166 + ).toErrorDev (
167 '`Foo` uses `getDerivedStateFromProps` but its initial state is ' +
168 'undefined. This is not recommended. Instead, define the initial state by ' +
169 'assigning an object to `this.state` in the constructor of `Foo`. ' +
@@ -267,7 +267,7 @@ describe 'ReactCoffeeScriptClass', ->
267
268 expect(->
269 test React.createElement(Foo), 'SPAN', ''
270 - ).toWarnDev('Foo.state: must be set to an object or null')
270 + ).toErrorDev('Foo.state: must be set to an object or null')
271 undefined
272
273 it 'should render with null in the initial state property', ->
@@ -409,7 +409,7 @@ describe 'ReactCoffeeScriptClass', ->
409
410 expect(->
411 test React.createElement(Foo), 'SPAN', 'foo'
412 - ).toWarnDev([
412 + ).toErrorDev([
413 'getInitialState was defined on Foo, a plain JavaScript class.',
414 'getDefaultProps was defined on Foo, a plain JavaScript class.',
415 'propTypes was defined as an instance property on Foo.',
@@ -448,7 +448,7 @@ describe 'ReactCoffeeScriptClass', ->
448
449 expect(->
450 test React.createElement(NamedComponent), 'SPAN', 'foo'
451 - ).toWarnDev(
451 + ).toErrorDev(
452 'Warning: NamedComponent has a method called componentShouldUpdate().
453 Did you mean shouldComponentUpdate()? The name is phrased as a
454 question because the function is expected to return a value.'
@@ -466,7 +466,7 @@ describe 'ReactCoffeeScriptClass', ->
466
467 expect(->
468 test React.createElement(NamedComponent), 'SPAN', 'foo'
469 - ).toWarnDev(
469 + ).toErrorDev(
470 'Warning: NamedComponent has a method called componentWillRecieveProps().
471 Did you mean componentWillReceiveProps()?'
472 )
@@ -483,7 +483,7 @@ describe 'ReactCoffeeScriptClass', ->
483
484 expect(->
485 test React.createElement(NamedComponent), 'SPAN', 'foo'
486 - ).toWarnDev(
486 + ).toErrorDev(
487 'Warning: NamedComponent has a method called UNSAFE_componentWillRecieveProps().
488 Did you mean UNSAFE_componentWillReceiveProps()?'
489 )
@@ -494,13 +494,13 @@ describe 'ReactCoffeeScriptClass', ->
494 test Inner(name: 'foo'), 'DIV', 'foo'
495 expect(->
496 expect(-> instance.replaceState {}).toThrow()
497 - ).toLowPriorityWarnDev(
497 + ).toWarnDev(
498 'replaceState(...) is deprecated in plain JavaScript React classes',
499 {withoutStack: true}
500 )
501 expect(->
502 expect(-> instance.isMounted()).toThrow()
503 - ).toLowPriorityWarnDev(
503 + ).toWarnDev(
504 'isMounted(...) is deprecated in plain JavaScript React classes',
505 {withoutStack: true}
506 )
packages/react/src/__tests__/ReactContextValidator-test.js
+17 -17
@@ -154,7 +154,7 @@ describe('ReactContextValidator', () => {
154 foo: PropTypes.string.isRequired,
155 };
156
157 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
157 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
158 'Warning: Failed context type: ' +
159 'The context `foo` is marked as required in `Component`, but its value ' +
160 'is `undefined`.\n' +
@@ -200,7 +200,7 @@ describe('ReactContextValidator', () => {
200 ReactTestUtils.renderIntoDocument(
201 <ComponentInFooNumberContext fooValue={123} />,
202 ),
203 - ).toWarnDev(
203 + ).toErrorDev(
204 'Warning: Failed context type: ' +
205 'Invalid context `foo` of type `number` supplied ' +
206 'to `Component`, expected `string`.\n' +
@@ -226,7 +226,7 @@ describe('ReactContextValidator', () => {
226
227 expect(() =>
228 ReactTestUtils.renderIntoDocument(<Component testContext={{bar: 123}} />),
229 - ).toWarnDev(
229 + ).toErrorDev(
230 'Warning: Failed child context type: ' +
231 'The child context `foo` is marked as required in `Component`, but its ' +
232 'value is `undefined`.\n' +
@@ -235,7 +235,7 @@ describe('ReactContextValidator', () => {
235
236 expect(() =>
237 ReactTestUtils.renderIntoDocument(<Component testContext={{foo: 123}} />),
238 - ).toWarnDev(
238 + ).toErrorDev(
239 'Warning: Failed child context type: ' +
240 'Invalid child context `foo` of type `number` ' +
241 'supplied to `Component`, expected `string`.\n' +
@@ -265,7 +265,7 @@ describe('ReactContextValidator', () => {
265 }
266 }
267
268 - expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
268 + expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
269 'Warning: Failed prop type: The prop `value` is marked as required in ' +
270 '`Context.Provider`, but its value is `undefined`.\n' +
271 ' in Component (at **)',
@@ -292,7 +292,7 @@ describe('ReactContextValidator', () => {
292 }
293 }
294
295 - expect(() => ReactTestUtils.renderIntoDocument(<ComponentA />)).toWarnDev(
295 + expect(() => ReactTestUtils.renderIntoDocument(<ComponentA />)).toErrorDev(
296 'Warning: ComponentA.childContextTypes is specified but there is no ' +
297 'getChildContext() method on the instance. You can either define ' +
298 'getChildContext() on ComponentA or remove childContextTypes from it.',
@@ -301,7 +301,7 @@ describe('ReactContextValidator', () => {
301 // Warnings should be deduped by component type
302 ReactTestUtils.renderIntoDocument(<ComponentA />);
303
304 - expect(() => ReactTestUtils.renderIntoDocument(<ComponentB />)).toWarnDev(
304 + expect(() => ReactTestUtils.renderIntoDocument(<ComponentB />)).toErrorDev(
305 'Warning: ComponentB.childContextTypes is specified but there is no ' +
306 'getChildContext() method on the instance. You can either define ' +
307 'getChildContext() on ComponentB or remove childContextTypes from it.',
@@ -348,7 +348,7 @@ describe('ReactContextValidator', () => {
348
349 expect(() =>
350 ReactTestUtils.renderIntoDocument(<ParentContextProvider />),
351 - ).toWarnDev([
351 + ).toErrorDev([
352 'Warning: MiddleMissingContext.childContextTypes is specified but there is no ' +
353 'getChildContext() method on the instance. You can either define getChildContext() ' +
354 'on MiddleMissingContext or remove childContextTypes from it.',
@@ -508,7 +508,7 @@ describe('ReactContextValidator', () => {
508 <ComponentA />
509 </ParentContextProvider>,
510 ),
511 - ).toWarnDev(
511 + ).toErrorDev(
512 'Warning: ComponentA declares both contextTypes and contextType static properties. ' +
513 'The legacy contextTypes property will be ignored.',
514 );
@@ -526,7 +526,7 @@ describe('ReactContextValidator', () => {
526 <ComponentB />
527 </ParentContextProvider>,
528 ),
529 - ).toWarnDev(
529 + ).toErrorDev(
530 'Warning: ComponentB declares both contextTypes and contextType static properties. ' +
531 'The legacy contextTypes property will be ignored.',
532 );
@@ -551,7 +551,7 @@ describe('ReactContextValidator', () => {
551
552 expect(() => {
553 ReactTestUtils.renderIntoDocument(<ComponentA />);
554 - }).toWarnDev(
554 + }).toErrorDev(
555 'Warning: ComponentA defines an invalid contextType. ' +
556 'contextType should point to the Context object returned by React.createContext(). ' +
557 'Did you accidentally pass the Context.Consumer instead?',
@@ -562,7 +562,7 @@ describe('ReactContextValidator', () => {
562
563 expect(() => {
564 ReactTestUtils.renderIntoDocument(<ComponentB />);
565 - }).toWarnDev(
565 + }).toErrorDev(
566 'Warning: ComponentB defines an invalid contextType. ' +
567 'contextType should point to the Context object returned by React.createContext(). ' +
568 'Did you accidentally pass the Context.Provider instead?',
@@ -595,7 +595,7 @@ describe('ReactContextValidator', () => {
595 expect(() => {
596 ReactTestUtils.renderIntoDocument(<Foo />);
597 }).toThrow("Cannot read property 'world' of undefined");
598 - }).toWarnDev(
598 + }).toErrorDev(
599 'Foo defines an invalid contextType. ' +
600 'contextType should point to the Context object returned by React.createContext(). ' +
601 'However, it is set to undefined. ' +
@@ -621,7 +621,7 @@ describe('ReactContextValidator', () => {
621 expect(() => {
622 ReactTestUtils.renderIntoDocument(<Foo />);
623 }).toThrow("Cannot read property 'hello' of undefined");
624 - }).toWarnDev(
624 + }).toErrorDev(
625 'Foo defines an invalid contextType. ' +
626 'contextType should point to the Context object returned by React.createContext(). ' +
627 'However, it is set to an object with keys {x, y}.',
@@ -640,7 +640,7 @@ describe('ReactContextValidator', () => {
640 expect(() => {
641 ReactTestUtils.renderIntoDocument(<Foo />);
642 }).toThrow("Cannot read property 'world' of undefined");
643 - }).toWarnDev(
643 + }).toErrorDev(
644 'Foo defines an invalid contextType. ' +
645 'contextType should point to the Context object returned by React.createContext(). ' +
646 'However, it is set to a string.',
@@ -660,14 +660,14 @@ describe('ReactContextValidator', () => {
660 }
661 ComponentB.contextType = Context;
662
663 - expect(() => ReactTestUtils.renderIntoDocument(<ComponentA />)).toWarnDev(
663 + expect(() => ReactTestUtils.renderIntoDocument(<ComponentA />)).toErrorDev(
664 'Warning: ComponentA: Function components do not support contextType.',
665 );
666
667 // Warnings should be deduped by component type
668 ReactTestUtils.renderIntoDocument(<ComponentA />);
669
670 - expect(() => ReactTestUtils.renderIntoDocument(<ComponentB />)).toWarnDev(
670 + expect(() => ReactTestUtils.renderIntoDocument(<ComponentB />)).toErrorDev(
671 'Warning: ComponentB: Function components do not support contextType.',
672 );
673 });
packages/react/src/__tests__/ReactCreateRef-test.js
+2 -2
@@ -37,7 +37,7 @@ describe('ReactCreateRef', () => {
37 <div ref={{}} />
38 </Wrapper>,
39 ),
40 - ).toWarnDev(
40 + ).toErrorDev(
41 'Unexpected ref object provided for div. ' +
42 'Use either a ref-setter function or React.createRef().\n' +
43 ' in div (at **)\n' +
@@ -50,7 +50,7 @@ describe('ReactCreateRef', () => {
50 <ExampleComponent ref={{}} />
51 </Wrapper>,
52 ),
53 - ).toWarnDev(
53 + ).toErrorDev(
54 'Unexpected ref object provided for ExampleComponent. ' +
55 'Use either a ref-setter function or React.createRef().\n' +
56 ' in ExampleComponent (at **)\n' +
packages/react/src/__tests__/ReactES6Class-test.js
+12 -16
@@ -59,7 +59,7 @@ describe('ReactES6Class', () => {
59 class Foo extends React.Component {}
60 expect(() =>
61 expect(() => ReactDOM.render(<Foo />, container)).toThrow(),
62 - ).toWarnDev([
62 + ).toErrorDev([
63 // A failed component renders twice in DEV
64 'Warning: Foo(...): No `render` method found on the returned component ' +
65 'instance: you may have forgotten to define `render`.',
@@ -137,7 +137,7 @@ describe('ReactES6Class', () => {
137 return <div />;
138 }
139 }
140 - expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toWarnDev(
140 + expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toErrorDev(
141 'Foo: getDerivedStateFromProps() is defined as an instance method ' +
142 'and will be ignored. Instead, declare it as a static method.',
143 );
@@ -152,7 +152,7 @@ describe('ReactES6Class', () => {
152 return <div />;
153 }
154 }
155 - expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toWarnDev(
155 + expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toErrorDev(
156 'Foo: getDerivedStateFromError() is defined as an instance method ' +
157 'and will be ignored. Instead, declare it as a static method.',
158 );
@@ -165,7 +165,7 @@ describe('ReactES6Class', () => {
165 return <div />;
166 }
167 }
168 - expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toWarnDev(
168 + expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toErrorDev(
169 'Foo: getSnapshotBeforeUpdate() is defined as a static method ' +
170 'and will be ignored. Instead, declare it as an instance method.',
171 );
@@ -183,7 +183,7 @@ describe('ReactES6Class', () => {
183 return <div className={`${this.state.foo} ${this.state.bar}`} />;
184 }
185 }
186 - expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toWarnDev(
186 + expect(() => ReactDOM.render(<Foo foo="foo" />, container)).toErrorDev(
187 '`Foo` uses `getDerivedStateFromProps` but its initial state is ' +
188 'undefined. This is not recommended. Instead, define the initial state by ' +
189 'assigning an object to `this.state` in the constructor of `Foo`. ' +
@@ -291,7 +291,7 @@ describe('ReactES6Class', () => {
291 return <span />;
292 }
293 }
294 - expect(() => test(<Foo />, 'SPAN', '')).toWarnDev(
294 + expect(() => test(<Foo />, 'SPAN', '')).toErrorDev(
295 'Foo.state: must be set to an object or null',
296 );
297 });
@@ -443,7 +443,7 @@ describe('ReactES6Class', () => {
443 }
444 }
445
446 - expect(() => test(<Foo />, 'SPAN', 'foo')).toWarnDev([
446 + expect(() => test(<Foo />, 'SPAN', 'foo')).toErrorDev([
447 'getInitialState was defined on Foo, a plain JavaScript class.',
448 'getDefaultProps was defined on Foo, a plain JavaScript class.',
449 'propTypes was defined as an instance property on Foo.',
@@ -477,7 +477,7 @@ describe('ReactES6Class', () => {
477 }
478 }
479
480 - expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toWarnDev(
480 + expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
481 'Warning: ' +
482 'NamedComponent has a method called componentShouldUpdate(). Did you ' +
483 'mean shouldComponentUpdate()? The name is phrased as a question ' +
@@ -495,7 +495,7 @@ describe('ReactES6Class', () => {
495 }
496 }
497
498 - expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toWarnDev(
498 + expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
499 'Warning: ' +
500 'NamedComponent has a method called componentWillRecieveProps(). Did ' +
501 'you mean componentWillReceiveProps()?',
@@ -512,7 +512,7 @@ describe('ReactES6Class', () => {
512 }
513 }
514
515 - expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toWarnDev(
515 + expect(() => test(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
516 'Warning: ' +
517 'NamedComponent has a method called UNSAFE_componentWillRecieveProps(). ' +
518 'Did you mean UNSAFE_componentWillReceiveProps()?',
@@ -521,15 +521,11 @@ describe('ReactES6Class', () => {
521
522 it('should throw AND warn when trying to access classic APIs', () => {
523 const instance = test(<Inner name="foo" />, 'DIV', 'foo');
524 - expect(() =>
525 - expect(() => instance.replaceState({})).toThrow(),
526 - ).toLowPriorityWarnDev(
524 + expect(() => expect(() => instance.replaceState({})).toThrow()).toWarnDev(
525 'replaceState(...) is deprecated in plain JavaScript React classes',
526 {withoutStack: true},
527 );
530 - expect(() =>
531 - expect(() => instance.isMounted()).toThrow(),
532 - ).toLowPriorityWarnDev(
528 + expect(() => expect(() => instance.isMounted()).toThrow()).toWarnDev(
529 'isMounted(...) is deprecated in plain JavaScript React classes',
530 {withoutStack: true},
531 );
packages/react/src/__tests__/ReactElement-test.js
+3 -3
@@ -75,7 +75,7 @@ describe('ReactElement', () => {
75 );
76 }
77 }
78 - expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
78 + expect(() => ReactDOM.render(<Parent />, container)).toErrorDev(
79 'Child: `key` is not a prop. Trying to access it will result ' +
80 'in `undefined` being returned. If you need to access the same ' +
81 'value within the child component, you should pass it as a different ' +
@@ -85,7 +85,7 @@ describe('ReactElement', () => {
85
86 it('should warn when `key` is being accessed on a host element', () => {
87 const element = <div key="3" />;
88 - expect(() => void element.props.key).toWarnDev(
88 + expect(() => void element.props.key).toErrorDev(
89 'div: `key` is not a prop. Trying to access it will result ' +
90 'in `undefined` being returned. If you need to access the same ' +
91 'value within the child component, you should pass it as a different ' +
@@ -110,7 +110,7 @@ describe('ReactElement', () => {
110 );
111 }
112 }
113 - expect(() => ReactDOM.render(<Parent />, container)).toWarnDev(
113 + expect(() => ReactDOM.render(<Parent />, container)).toErrorDev(
114 'Child: `ref` is not a prop. Trying to access it will result ' +
115 'in `undefined` being returned. If you need to access the same ' +
116 'value within the child component, you should pass it as a different ' +
packages/react/src/__tests__/ReactElementClone-test.js
+2 -2
@@ -259,7 +259,7 @@ describe('ReactElementClone', () => {
259 it('warns for keys for arrays of elements in rest args', () => {
260 expect(() =>
261 React.cloneElement(<div />, null, [<div />, <div />]),
262 - ).toWarnDev('Each child in a list should have a unique "key" prop.');
262 + ).toErrorDev('Each child in a list should have a unique "key" prop.');
263 });
264
265 it('does not warns for arrays of elements with keys', () => {
@@ -297,7 +297,7 @@ describe('ReactElementClone', () => {
297 }
298 expect(() =>
299 ReactTestUtils.renderIntoDocument(React.createElement(GrandParent)),
300 - ).toWarnDev(
300 + ).toErrorDev(
301 'Warning: Failed prop type: ' +
302 'Invalid prop `color` of type `number` supplied to `Component`, ' +
303 'expected `string`.\n' +
packages/react/src/__tests__/ReactElementJSX-test.internal.js
+6 -6
@@ -206,7 +206,7 @@ describe('ReactElement.jsx', () => {
206 });
207 }
208 }
209 - expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
209 + expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toErrorDev(
210 'Child: `key` is not a prop. Trying to access it will result ' +
211 'in `undefined` being returned. If you need to access the same ' +
212 'value within the child component, you should pass it as a different ' +
@@ -218,7 +218,7 @@ describe('ReactElement.jsx', () => {
218 const container = document.createElement('div');
219 expect(() =>
220 ReactDOM.render(React.jsxs('div', {children: 'foo'}, null), container),
221 - ).toWarnDev(
221 + ).toErrorDev(
222 'React.jsx: Static children should always be an array. ' +
223 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' +
224 'Use the Babel transform instead.',
@@ -228,7 +228,7 @@ describe('ReactElement.jsx', () => {
228
229 it('should warn when `key` is being accessed on a host element', () => {
230 const element = React.jsxs('div', {}, '3');
231 - expect(() => void element.props.key).toWarnDev(
231 + expect(() => void element.props.key).toErrorDev(
232 'div: `key` is not a prop. Trying to access it will result ' +
233 'in `undefined` being returned. If you need to access the same ' +
234 'value within the child component, you should pass it as a different ' +
@@ -251,7 +251,7 @@ describe('ReactElement.jsx', () => {
251 });
252 }
253 }
254 - expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
254 + expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toErrorDev(
255 'Child: `ref` is not a prop. Trying to access it will result ' +
256 'in `undefined` being returned. If you need to access the same ' +
257 'value within the child component, you should pass it as a different ' +
@@ -321,7 +321,7 @@ describe('ReactElement.jsx', () => {
321 });
322 }
323 }
324 - expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
324 + expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toErrorDev(
325 'Warning: Each child in a list should have a unique "key" prop.\n\n' +
326 'Check the render method of `Parent`. See https://fb.me/react-warning-keys for more information.\n' +
327 ' in Child (created by Parent)\n' +
@@ -343,7 +343,7 @@ describe('ReactElement.jsx', () => {
343 });
344 }
345 }
346 - expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
346 + expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toErrorDev(
347 'Warning: React.jsx: Spreading a key to JSX is a deprecated pattern. ' +
348 'Explicitly pass a key after spreading props in your JSX call. ' +
349 'E.g. <ComponentName {...props} key={key} />',
packages/react/src/__tests__/ReactElementValidator-test.internal.js
+17 -17
@@ -42,7 +42,7 @@ describe('ReactElementValidator', () => {
42
43 expect(() => {
44 Component(null, [Component(), Component()]);
45 - }).toWarnDev('Each child in a list should have a unique "key" prop.');
45 + }).toErrorDev('Each child in a list should have a unique "key" prop.');
46 });
47
48 it('warns for keys for arrays of elements with owner info', () => {
@@ -64,7 +64,7 @@ describe('ReactElementValidator', () => {
64
65 expect(() => {
66 ReactTestUtils.renderIntoDocument(React.createElement(ComponentWrapper));
67 - }).toWarnDev(
67 + }).toErrorDev(
68 'Each child in a list should have a unique "key" prop.' +
69 '\n\nCheck the render method of `InnerClass`. ' +
70 'It was passed a child from ComponentWrapper. ',
@@ -81,7 +81,7 @@ describe('ReactElementValidator', () => {
81
82 expect(() => {
83 ReactTestUtils.renderIntoDocument(<Anonymous>{divs}</Anonymous>);
84 - }).toWarnDev(
84 + }).toErrorDev(
85 'Warning: Each child in a list should have a unique ' +
86 '"key" prop. See https://fb.me/react-warning-keys for more information.\n' +
87 ' in div (at **)',
@@ -93,7 +93,7 @@ describe('ReactElementValidator', () => {
93
94 expect(() => {
95 ReactTestUtils.renderIntoDocument(<div>{divs}</div>);
96 - }).toWarnDev(
96 + }).toErrorDev(
97 'Warning: Each child in a list should have a unique ' +
98 '"key" prop.\n\nCheck the top-level render call using <div>. See ' +
99 'https://fb.me/react-warning-keys for more information.\n' +
@@ -114,7 +114,7 @@ describe('ReactElementValidator', () => {
114 return <Parent child={<Component />} />;
115 }
116
117 - expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toWarnDev(
117 + expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toErrorDev(
118 'Warning: Each child in a list should have a unique ' +
119 '"key" prop.\n\nCheck the render method of `Component`. See ' +
120 'https://fb.me/react-warning-keys for more information.\n' +
@@ -158,7 +158,7 @@ describe('ReactElementValidator', () => {
158 },
159 };
160
161 - expect(() => Component(null, iterable)).toWarnDev(
161 + expect(() => Component(null, iterable)).toErrorDev(
162 'Each child in a list should have a unique "key" prop.',
163 );
164 });
@@ -217,7 +217,7 @@ describe('ReactElementValidator', () => {
217 }
218 expect(() => {
219 ReactTestUtils.renderIntoDocument(React.createElement(ParentComp));
220 - }).toWarnDev(
220 + }).toErrorDev(
221 'Warning: Failed prop type: ' +
222 'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
223 'expected `string`.\n' +
@@ -238,7 +238,7 @@ describe('ReactElementValidator', () => {
238 React.createElement(React.createElement(Foo));
239 React.createElement(React.createElement(React.createContext().Consumer));
240 React.createElement({$$typeof: 'non-react-thing'});
241 - }).toWarnDev(
241 + }).toErrorDev(
242 [
243 'Warning: React.createElement: type is invalid -- expected a string ' +
244 '(for built-in components) or a class/function (for composite ' +
@@ -295,7 +295,7 @@ describe('ReactElementValidator', () => {
295 'or a class/function (for composite components) but got: null.' +
296 (__DEV__ ? '\n\nCheck the render method of `ParentComp`.' : ''),
297 );
298 - }).toWarnDev(
298 + }).toErrorDev(
299 'Warning: React.createElement: type is invalid -- expected a string ' +
300 '(for built-in components) or a class/function (for composite ' +
301 'components) but got: null.' +
@@ -314,7 +314,7 @@ describe('ReactElementValidator', () => {
314
315 expect(() =>
316 ReactTestUtils.renderIntoDocument(React.createElement(Component)),
317 - ).toWarnDev(
317 + ).toErrorDev(
318 'Warning: Failed prop type: The prop `prop` is marked as required in ' +
319 '`Component`, but its value is `null`.\n' +
320 ' in Component',
@@ -334,7 +334,7 @@ describe('ReactElementValidator', () => {
334 ReactTestUtils.renderIntoDocument(
335 React.createElement(Component, {prop: null}),
336 );
337 - }).toWarnDev(
337 + }).toErrorDev(
338 'Warning: Failed prop type: The prop `prop` is marked as required in ' +
339 '`Component`, but its value is `null`.\n' +
340 ' in Component',
@@ -356,7 +356,7 @@ describe('ReactElementValidator', () => {
356 ReactTestUtils.renderIntoDocument(
357 React.createElement(Component, {prop: 42}),
358 );
359 - }).toWarnDev([
359 + }).toErrorDev([
360 'Warning: Failed prop type: ' +
361 'The prop `prop` is marked as required in `Component`, but its value ' +
362 'is `undefined`.\n' +
@@ -387,7 +387,7 @@ describe('ReactElementValidator', () => {
387 ReactTestUtils.renderIntoDocument(
388 React.createElement(Component, {myProp: {value: 'hi'}}),
389 );
390 - }).toWarnDev(
390 + }).toErrorDev(
391 'Warning: Component: type specification of prop `myProp` is invalid; ' +
392 'the type checker function must return `null` or an `Error` but ' +
393 'returned a function. You may have forgotten to pass an argument to ' +
@@ -411,7 +411,7 @@ describe('ReactElementValidator', () => {
411 ReactTestUtils.renderIntoDocument(
412 React.createElement(MisspelledPropTypesComponent, {prop: 'Hi'}),
413 );
414 - }).toWarnDev(
414 + }).toErrorDev(
415 'Warning: Component MisspelledPropTypesComponent declared `PropTypes` ' +
416 'instead of `propTypes`. Did you misspell the property assignment?',
417 {withoutStack: true},
@@ -427,7 +427,7 @@ describe('ReactElementValidator', () => {
427
428 expect(() => {
429 ReactTestUtils.renderIntoDocument(React.createElement(Foo));
430 - }).toWarnDev(
430 + }).toErrorDev(
431 'Invalid prop `a` supplied to `React.Fragment`. React.Fragment ' +
432 'can only have `key` and `children` props.',
433 );
@@ -439,7 +439,7 @@ describe('ReactElementValidator', () => {
439 }
440
441 let TestFactory = React.createFactory(TestComponent);
442 - expect(() => TestFactory.type).toLowPriorityWarnDev(
442 + expect(() => TestFactory.type).toWarnDev(
443 'Warning: Factory.type is deprecated. Access the class directly before ' +
444 'passing it to createFactory.',
445 {withoutStack: true},
@@ -504,7 +504,7 @@ describe('ReactElementValidator', () => {
504 const Foo = undefined;
505 expect(() => {
506 void <Foo>{[<div />]}</Foo>;
507 - }).toWarnDev(
507 + }).toErrorDev(
508 'Warning: React.createElement: type is invalid -- expected a string ' +
509 '(for built-in components) or a class/function (for composite ' +
510 'components) but got: undefined. You likely forgot to export your ' +
packages/react/src/__tests__/ReactJSXElementValidator-test.js
+19 -19
@@ -48,7 +48,7 @@ describe('ReactJSXElementValidator', () => {
48 ReactTestUtils.renderIntoDocument(
49 <Component>{[<Component />, <Component />]}</Component>,
50 ),
51 - ).toWarnDev('Each child in a list should have a unique "key" prop.');
51 + ).toErrorDev('Each child in a list should have a unique "key" prop.');
52 });
53
54 it('warns for keys for arrays of elements with owner info', () => {
@@ -66,7 +66,7 @@ describe('ReactJSXElementValidator', () => {
66
67 expect(() =>
68 ReactTestUtils.renderIntoDocument(<ComponentWrapper />),
69 - ).toWarnDev(
69 + ).toErrorDev(
70 'Each child in a list should have a unique "key" prop.' +
71 '\n\nCheck the render method of `InnerComponent`. ' +
72 'It was passed a child from ComponentWrapper. ',
@@ -88,7 +88,7 @@ describe('ReactJSXElementValidator', () => {
88
89 expect(() =>
90 ReactTestUtils.renderIntoDocument(<Component>{iterable}</Component>),
91 - ).toWarnDev('Each child in a list should have a unique "key" prop.');
91 + ).toErrorDev('Each child in a list should have a unique "key" prop.');
92 });
93
94 it('does not warn for arrays of elements with keys', () => {
@@ -163,7 +163,7 @@ describe('ReactJSXElementValidator', () => {
163 return <MyComp color={123} />;
164 }
165 }
166 - expect(() => ReactTestUtils.renderIntoDocument(<ParentComp />)).toWarnDev(
166 + expect(() => ReactTestUtils.renderIntoDocument(<ParentComp />)).toErrorDev(
167 'Warning: Failed prop type: ' +
168 'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
169 'expected `string`.\n' +
@@ -195,7 +195,7 @@ describe('ReactJSXElementValidator', () => {
195 ReactDOM.render(<ParentComp warn={false} />, container);
196 expect(() =>
197 ReactDOM.render(<ParentComp warn={true} />, container),
198 - ).toWarnDev(
198 + ).toErrorDev(
199 'Warning: Failed prop type: ' +
200 'Invalid prop `color` of type `number` supplied to `MyComp`, ' +
201 'expected `string`.\n' +
@@ -210,7 +210,7 @@ describe('ReactJSXElementValidator', () => {
210 const Null = null;
211 const True = true;
212 const Div = 'div';
213 - expect(() => void <Undefined />).toWarnDev(
213 + expect(() => void <Undefined />).toErrorDev(
214 'Warning: React.createElement: type is invalid -- expected a string ' +
215 '(for built-in components) or a class/function (for composite ' +
216 'components) but got: undefined. You likely forgot to export your ' +
@@ -219,14 +219,14 @@ describe('ReactJSXElementValidator', () => {
219 '\n\nCheck your code at **.',
220 {withoutStack: true},
221 );
222 - expect(() => void <Null />).toWarnDev(
222 + expect(() => void <Null />).toErrorDev(
223 'Warning: React.createElement: type is invalid -- expected a string ' +
224 '(for built-in components) or a class/function (for composite ' +
225 'components) but got: null.' +
226 '\n\nCheck your code at **.',
227 {withoutStack: true},
228 );
229 - expect(() => void <True />).toWarnDev(
229 + expect(() => void <True />).toErrorDev(
230 'Warning: React.createElement: type is invalid -- expected a string ' +
231 '(for built-in components) or a class/function (for composite ' +
232 'components) but got: boolean.' +
@@ -242,7 +242,7 @@ describe('ReactJSXElementValidator', () => {
242
243 expect(() =>
244 ReactTestUtils.renderIntoDocument(<RequiredPropComponent />),
245 - ).toWarnDev(
245 + ).toErrorDev(
246 'Warning: Failed prop type: The prop `prop` is marked as required in ' +
247 '`RequiredPropComponent`, but its value is `null`.\n' +
248 ' in RequiredPropComponent (at **)',
@@ -252,7 +252,7 @@ describe('ReactJSXElementValidator', () => {
252 it('should not check the default for explicit null', () => {
253 expect(() =>
254 ReactTestUtils.renderIntoDocument(<RequiredPropComponent prop={null} />),
255 - ).toWarnDev(
255 + ).toErrorDev(
256 'Warning: Failed prop type: The prop `prop` is marked as required in ' +
257 '`RequiredPropComponent`, but its value is `null`.\n' +
258 ' in RequiredPropComponent (at **)',
@@ -262,7 +262,7 @@ describe('ReactJSXElementValidator', () => {
262 it('should check declared prop types', () => {
263 expect(() =>
264 ReactTestUtils.renderIntoDocument(<RequiredPropComponent />),
265 - ).toWarnDev(
265 + ).toErrorDev(
266 'Warning: Failed prop type: ' +
267 'The prop `prop` is marked as required in `RequiredPropComponent`, but ' +
268 'its value is `undefined`.\n' +
@@ -270,7 +270,7 @@ describe('ReactJSXElementValidator', () => {
270 );
271 expect(() =>
272 ReactTestUtils.renderIntoDocument(<RequiredPropComponent prop={42} />),
273 - ).toWarnDev(
273 + ).toErrorDev(
274 'Warning: Failed prop type: ' +
275 'Invalid prop `prop` of type `number` supplied to ' +
276 '`RequiredPropComponent`, expected `string`.\n' +
@@ -296,7 +296,7 @@ describe('ReactJSXElementValidator', () => {
296 };
297 expect(() =>
298 ReactTestUtils.renderIntoDocument(<NullPropTypeComponent />),
299 - ).toWarnDev(
299 + ).toErrorDev(
300 'NullPropTypeComponent: prop type `prop` is invalid; it must be a ' +
301 'function, usually from the `prop-types` package,',
302 );
@@ -313,7 +313,7 @@ describe('ReactJSXElementValidator', () => {
313 };
314 expect(() =>
315 ReactTestUtils.renderIntoDocument(<NullContextTypeComponent />),
316 - ).toWarnDev(
316 + ).toErrorDev(
317 'NullContextTypeComponent: context type `prop` is invalid; it must ' +
318 'be a function, usually from the `prop-types` package,',
319 );
@@ -330,7 +330,7 @@ describe('ReactJSXElementValidator', () => {
330 });
331 expect(() =>
332 ReactTestUtils.renderIntoDocument(<GetDefaultPropsComponent />),
333 - ).toWarnDev(
333 + ).toErrorDev(
334 'getDefaultProps is only used on classic React.createClass definitions.' +
335 ' Use a static property named `defaultProps` instead.',
336 {withoutStack: true},
@@ -350,7 +350,7 @@ describe('ReactJSXElementValidator', () => {
350 ReactTestUtils.renderIntoDocument(
351 <MisspelledPropTypesComponent prop="hi" />,
352 ),
353 - ).toWarnDev(
353 + ).toErrorDev(
354 'Warning: Component MisspelledPropTypesComponent declared `PropTypes` ' +
355 'instead of `propTypes`. Did you misspell the property assignment?',
356 {withoutStack: true},
@@ -364,7 +364,7 @@ describe('ReactJSXElementValidator', () => {
364 }
365 }
366
367 - expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toWarnDev(
367 + expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toErrorDev(
368 'Invalid prop `a` supplied to `React.Fragment`. React.Fragment ' +
369 'can only have `key` and `children` props.',
370 );
@@ -384,7 +384,7 @@ describe('ReactJSXElementValidator', () => {
384 }
385 }
386
387 - expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toWarnDev(
387 + expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toErrorDev(
388 'Invalid attribute `ref` supplied to `React.Fragment`.',
389 );
390 });
@@ -407,7 +407,7 @@ describe('ReactJSXElementValidator', () => {
407 <span key="b">3</span>
408 </>,
409 ),
410 - ).toWarnDev('Encountered two children with the same key, `a`.', {
410 + ).toErrorDev('Encountered two children with the same key, `a`.', {
411 withoutStack: true,
412 });
413 });
packages/react/src/__tests__/ReactProfiler-test.internal.js
+1 -1
@@ -117,7 +117,7 @@ describe('Profiler', () => {
117 it('should warn if required params are missing', () => {
118 expect(() => {
119 ReactTestRenderer.create(<React.Profiler />);
120 - }).toWarnDev(
120 + }).toErrorDev(
121 'Profiler must specify an "id" string and "onRender" function as props',
122 {withoutStack: true},
123 );
packages/react/src/__tests__/ReactPureComponent-test.js
+2 -2
@@ -74,7 +74,7 @@ describe('ReactPureComponent', () => {
74 }
75
76 const container = document.createElement('div');
77 - expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
77 + expect(() => ReactDOM.render(<Component />, container)).toErrorDev(
78 'Warning: ' +
79 'Component has a method called shouldComponentUpdate(). ' +
80 'shouldComponentUpdate should not be used when extending React.PureComponent. ' +
@@ -108,7 +108,7 @@ describe('ReactPureComponent', () => {
108 }
109 }
110 const container = document.createElement('div');
111 - expect(() => ReactDOM.render(<PureComponent />, container)).toWarnDev(
111 + expect(() => ReactDOM.render(<PureComponent />, container)).toErrorDev(
112 'Warning: ' +
113 'PureComponent has a method called shouldComponentUpdate(). ' +
114 'shouldComponentUpdate should not be used when extending React.PureComponent. ' +
packages/react/src/__tests__/ReactStrictMode-test.js
+11 -11
@@ -36,7 +36,7 @@ describe('ReactStrictMode', () => {
36 </React.StrictMode>,
37 container,
38 );
39 - }).toWarnDev(
39 + }).toErrorDev(
40 'Invalid ARIA attribute `ariaTypo`. ' +
41 'ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
42 ' in div (at **)\n' +
@@ -56,7 +56,7 @@ describe('ReactStrictMode', () => {
56 <Foo />
57 </React.StrictMode>,
58 );
59 - }).toWarnDev(
59 + }).toErrorDev(
60 'Invalid ARIA attribute `ariaTypo`. ' +
61 'ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
62 ' in div (at **)\n' +
@@ -399,7 +399,7 @@ describe('Concurrent Mode', () => {
399 const container = document.createElement('div');
400 const root = ReactDOM.createRoot(container);
401 root.render(<AsyncRoot />);
402 - expect(() => Scheduler.unstable_flushAll()).toWarnDev(
402 + expect(() => Scheduler.unstable_flushAll()).toErrorDev(
403 [
404 /* eslint-disable max-len */
405 `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
@@ -457,7 +457,7 @@ Please update the following components: AsyncRoot`,
457 root.render(<AsyncRoot />);
458
459 expect(() => {
460 - expect(() => Scheduler.unstable_flushAll()).toWarnDev(
460 + expect(() => Scheduler.unstable_flushAll()).toErrorDev(
461 [
462 /* eslint-disable max-len */
463 `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.
@@ -480,7 +480,7 @@ Please update the following components: AsyncRoot`,
480 ],
481 {withoutStack: true},
482 );
483 - }).toLowPriorityWarnDev(
483 + }).toWarnDev(
484 [
485 /* eslint-disable max-len */
486 `Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
@@ -535,13 +535,13 @@ Please update the following components: Parent`,
535 const container = document.createElement('div');
536 const root = ReactDOM.createRoot(container);
537 root.render(<AsyncRoot foo={true} />);
538 - expect(() => Scheduler.unstable_flushAll()).toWarnDev(
538 + expect(() => Scheduler.unstable_flushAll()).toErrorDev(
539 'Using UNSAFE_componentWillMount in strict mode is not recommended',
540 {withoutStack: true},
541 );
542
543 root.render(<AsyncRoot foo={false} />);
544 - expect(() => Scheduler.unstable_flushAll()).toWarnDev(
544 + expect(() => Scheduler.unstable_flushAll()).toErrorDev(
545 'Using UNSAFE_componentWillMount in strict mode is not recommended',
546 {withoutStack: true},
547 );
@@ -592,7 +592,7 @@ Please update the following components: Parent`,
592
593 const container = document.createElement('div');
594
595 - expect(() => ReactDOM.render(<SyncRoot />, container)).toWarnDev(
595 + expect(() => ReactDOM.render(<SyncRoot />, container)).toErrorDev(
596 'Using UNSAFE_componentWillReceiveProps in strict mode is not recommended',
597 {withoutStack: true},
598 );
@@ -743,7 +743,7 @@ describe('string refs', () => {
743 const container = document.createElement('div');
744 expect(() => {
745 ReactDOM.render(<OuterComponent />, container);
746 - }).toWarnDev(
746 + }).toErrorDev(
747 'Warning: A string ref, "somestring", has been found within a strict mode tree. ' +
748 'String refs are a source of potential bugs and should be avoided. ' +
749 'We recommend using useRef() or createRef() instead. ' +
@@ -785,7 +785,7 @@ describe('string refs', () => {
785 const container = document.createElement('div');
786 expect(() => {
787 ReactDOM.render(<OuterComponent />, container);
788 - }).toWarnDev(
788 + }).toErrorDev(
789 'Warning: A string ref, "somestring", has been found within a strict mode tree. ' +
790 'String refs are a source of potential bugs and should be avoided. ' +
791 'We recommend using useRef() or createRef() instead. ' +
@@ -864,7 +864,7 @@ describe('context legacy', () => {
864 const container = document.createElement('div');
865 expect(() => {
866 ReactDOM.render(<Root />, container);
867 - }).toWarnDev(
867 + }).toErrorDev(
868 'Warning: Legacy context API has been detected within a strict-mode tree.' +
869 '\n\nThe old API will be supported in all 16.x releases, but applications ' +
870 'using it should migrate to the new version.' +
packages/react/src/__tests__/ReactTypeScriptClass-test.ts
+14 -14
@@ -326,7 +326,7 @@ describe('ReactTypeScriptClass', function() {
326 expect(() =>
327 ReactDOM.render(React.createElement(Empty), container)
328 ).toThrow()
329 - ).toWarnDev([
329 + ).toErrorDev([
330 // A failed component renders twice in DEV
331 'Warning: Empty(...): No `render` method found on the returned ' +
332 'component instance: you may have forgotten to define `render`.',
@@ -390,7 +390,7 @@ describe('ReactTypeScriptClass', function() {
390 }
391 expect(function() {
392 ReactDOM.render(React.createElement(Foo, {foo: 'foo'}), container);
393 - }).toWarnDev(
393 + }).toErrorDev(
394 'Foo: getDerivedStateFromProps() is defined as an instance method ' +
395 'and will be ignored. Instead, declare it as a static method.'
396 );
@@ -407,7 +407,7 @@ describe('ReactTypeScriptClass', function() {
407 }
408 expect(function() {
409 ReactDOM.render(React.createElement(Foo, {foo: 'foo'}), container);
410 - }).toWarnDev(
410 + }).toErrorDev(
411 'Foo: getDerivedStateFromError() is defined as an instance method ' +
412 'and will be ignored. Instead, declare it as a static method.'
413 );
@@ -423,7 +423,7 @@ describe('ReactTypeScriptClass', function() {
423 }
424 expect(function() {
425 ReactDOM.render(React.createElement(Foo, {foo: 'foo'}), container);
426 - }).toWarnDev(
426 + }).toErrorDev(
427 'Foo: getSnapshotBeforeUpdate() is defined as a static method ' +
428 'and will be ignored. Instead, declare it as an instance method.'
429 );
@@ -445,7 +445,7 @@ describe('ReactTypeScriptClass', function() {
445 }
446 expect(function() {
447 ReactDOM.render(React.createElement(Foo, {foo: 'foo'}), container);
448 - }).toWarnDev(
448 + }).toErrorDev(
449 '`Foo` uses `getDerivedStateFromProps` but its initial state is ' +
450 'undefined. This is not recommended. Instead, define the initial state by ' +
451 'assigning an object to `this.state` in the constructor of `Foo`. ' +
@@ -505,13 +505,13 @@ describe('ReactTypeScriptClass', function() {
505 });
506
507 it('should warn with non-object in the initial state property', function() {
508 - expect(() => test(React.createElement(ArrayState), 'SPAN', '')).toWarnDev(
508 + expect(() => test(React.createElement(ArrayState), 'SPAN', '')).toErrorDev(
509 'ArrayState.state: must be set to an object or null'
510 );
511 - expect(() => test(React.createElement(StringState), 'SPAN', '')).toWarnDev(
511 + expect(() => test(React.createElement(StringState), 'SPAN', '')).toErrorDev(
512 'StringState.state: must be set to an object or null'
513 );
514 - expect(() => test(React.createElement(NumberState), 'SPAN', '')).toWarnDev(
514 + expect(() => test(React.createElement(NumberState), 'SPAN', '')).toErrorDev(
515 'NumberState.state: must be set to an object or null'
516 );
517 });
@@ -581,7 +581,7 @@ describe('ReactTypeScriptClass', function() {
581 getDefaultPropsWasCalled = false;
582 expect(() =>
583 test(React.createElement(ClassicProperties), 'SPAN', 'foo')
584 - ).toWarnDev([
584 + ).toErrorDev([
585 'getInitialState was defined on ClassicProperties, ' +
586 'a plain JavaScript class.',
587 'getDefaultProps was defined on ClassicProperties, ' +
@@ -616,7 +616,7 @@ describe('ReactTypeScriptClass', function() {
616 it('should warn when misspelling shouldComponentUpdate', function() {
617 expect(() =>
618 test(React.createElement(MisspelledComponent1), 'SPAN', 'foo')
619 - ).toWarnDev(
619 + ).toErrorDev(
620 'Warning: ' +
621 'MisspelledComponent1 has a method called componentShouldUpdate(). Did ' +
622 'you mean shouldComponentUpdate()? The name is phrased as a question ' +
@@ -627,7 +627,7 @@ describe('ReactTypeScriptClass', function() {
627 it('should warn when misspelling componentWillReceiveProps', function() {
628 expect(() =>
629 test(React.createElement(MisspelledComponent2), 'SPAN', 'foo')
630 - ).toWarnDev(
630 + ).toErrorDev(
631 'Warning: ' +
632 'MisspelledComponent2 has a method called componentWillRecieveProps(). ' +
633 'Did you mean componentWillReceiveProps()?'
@@ -637,7 +637,7 @@ describe('ReactTypeScriptClass', function() {
637 it('should warn when misspelling UNSAFE_componentWillReceiveProps', function() {
638 expect(() =>
639 test(React.createElement(MisspelledComponent3), 'SPAN', 'foo')
640 - ).toWarnDev(
640 + ).toErrorDev(
641 'Warning: ' +
642 'MisspelledComponent3 has a method called UNSAFE_componentWillRecieveProps(). ' +
643 'Did you mean UNSAFE_componentWillReceiveProps()?'
@@ -652,13 +652,13 @@ describe('ReactTypeScriptClass', function() {
652 );
653 expect(() =>
654 expect(() => instance.replaceState({})).toThrow()
655 - ).toLowPriorityWarnDev(
655 + ).toWarnDev(
656 'replaceState(...) is deprecated in plain JavaScript React classes',
657 {withoutStack: true}
658 );
659 expect(() =>
660 expect(() => instance.isMounted()).toThrow()
661 - ).toLowPriorityWarnDev(
661 + ).toWarnDev(
662 'isMounted(...) is deprecated in plain JavaScript React classes',
663 {withoutStack: true}
664 );
packages/react/src/__tests__/createReactClassIntegration-test.internal.js
+2 -2
@@ -50,7 +50,7 @@ describe('create-react-class-integration', () => {
50 render: () => null,
51 });
52
53 - expect(() => ReactNative.render(<View />, 1)).toLowPriorityWarnDev(
53 + expect(() => ReactNative.render(<View />, 1)).toWarnDev(
54 'componentWillMount has been renamed',
55 {withoutStack: true},
56 );
@@ -64,7 +64,7 @@ describe('create-react-class-integration', () => {
64 render: () => null,
65 });
66
67 - expect(() => ReactNative.render(<View />, 1)).toLowPriorityWarnDev(
67 + expect(() => ReactNative.render(<View />, 1)).toWarnDev(
68 'componentWillReceiveProps has been renamed',
69 {withoutStack: true},
70 );
packages/react/src/__tests__/createReactClassIntegration-test.js
+19 -21
@@ -63,7 +63,7 @@ describe('create-react-class-integration', () => {
63 return <span>{this.props.prop}</span>;
64 },
65 }),
66 - ).toWarnDev(
66 + ).toErrorDev(
67 'Warning: Component: prop type `prop` is invalid; ' +
68 'it must be a function, usually from React.PropTypes.',
69 {withoutStack: true},
@@ -81,7 +81,7 @@ describe('create-react-class-integration', () => {
81 return <span>{this.props.prop}</span>;
82 },
83 }),
84 - ).toWarnDev(
84 + ).toErrorDev(
85 'Warning: Component: context type `prop` is invalid; ' +
86 'it must be a function, usually from React.PropTypes.',
87 {withoutStack: true},
@@ -99,7 +99,7 @@ describe('create-react-class-integration', () => {
99 return <span>{this.props.prop}</span>;
100 },
101 }),
102 - ).toWarnDev(
102 + ).toErrorDev(
103 'Warning: Component: child context type `prop` is invalid; ' +
104 'it must be a function, usually from React.PropTypes.',
105 {withoutStack: true},
@@ -116,7 +116,7 @@ describe('create-react-class-integration', () => {
116 return <div />;
117 },
118 }),
119 - ).toWarnDev(
119 + ).toErrorDev(
120 'Warning: A component has a method called componentShouldUpdate(). Did you ' +
121 'mean shouldComponentUpdate()? The name is phrased as a question ' +
122 'because the function is expected to return a value.',
@@ -133,7 +133,7 @@ describe('create-react-class-integration', () => {
133 return <div />;
134 },
135 }),
136 - ).toWarnDev(
136 + ).toErrorDev(
137 'Warning: NamedComponent has a method called componentShouldUpdate(). Did you ' +
138 'mean shouldComponentUpdate()? The name is phrased as a question ' +
139 'because the function is expected to return a value.',
@@ -151,7 +151,7 @@ describe('create-react-class-integration', () => {
151 return <div />;
152 },
153 }),
154 - ).toWarnDev(
154 + ).toErrorDev(
155 'Warning: A component has a method called componentWillRecieveProps(). Did you ' +
156 'mean componentWillReceiveProps()?',
157 {withoutStack: true},
@@ -168,7 +168,7 @@ describe('create-react-class-integration', () => {
168 return <div />;
169 },
170 }),
171 - ).toWarnDev(
171 + ).toErrorDev(
172 'Warning: A component has a method called UNSAFE_componentWillRecieveProps(). ' +
173 'Did you mean UNSAFE_componentWillReceiveProps()?',
174 {withoutStack: true},
@@ -216,7 +216,7 @@ describe('create-react-class-integration', () => {
216 return <div />;
217 },
218 }),
219 - ).toWarnDev([
219 + ).toErrorDev([
220 'createClass(...): `mixins` is now a static property and should ' +
221 'be defined inside "statics".',
222 'createClass(...): `propTypes` is now a static property and should ' +
@@ -361,7 +361,7 @@ describe('create-react-class-integration', () => {
361 },
362 });
363
364 - expect(() => expect(() => Component()).toThrow()).toWarnDev(
364 + expect(() => expect(() => Component()).toThrow()).toErrorDev(
365 'Warning: Something is calling a React component directly. Use a ' +
366 'factory or JSX instead. See: https://fb.me/react-legacyfactory',
367 {withoutStack: true},
@@ -453,7 +453,7 @@ describe('create-react-class-integration', () => {
453 });
454 expect(() =>
455 ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
456 - ).toWarnDev(
456 + ).toErrorDev(
457 'Foo: getDerivedStateFromProps() is defined as an instance method ' +
458 'and will be ignored. Instead, declare it as a static method.',
459 );
@@ -471,7 +471,7 @@ describe('create-react-class-integration', () => {
471 });
472 expect(() =>
473 ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
474 - ).toWarnDev(
474 + ).toErrorDev(
475 'Foo: getDerivedStateFromError() is defined as an instance method ' +
476 'and will be ignored. Instead, declare it as a static method.',
477 );
@@ -491,7 +491,7 @@ describe('create-react-class-integration', () => {
491 });
492 expect(() =>
493 ReactDOM.render(<Foo foo="foo" />, document.createElement('div')),
494 - ).toWarnDev(
494 + ).toErrorDev(
495 'Foo: getSnapshotBeforeUpdate() is defined as a static method ' +
496 'and will be ignored. Instead, declare it as an instance method.',
497 );
@@ -511,7 +511,7 @@ describe('create-react-class-integration', () => {
511 });
512 expect(() =>
513 ReactDOM.render(<Component />, document.createElement('div')),
514 - ).toWarnDev(
514 + ).toErrorDev(
515 '`Component` uses `getDerivedStateFromProps` but its initial state is ' +
516 'null. This is not recommended. Instead, define the initial state by ' +
517 'assigning an object to `this.state` in the constructor of `Component`. ' +
@@ -546,7 +546,7 @@ describe('create-react-class-integration', () => {
546 expect(() => {
547 expect(() => {
548 ReactDOM.render(<Component />, document.createElement('div'));
549 - }).toWarnDev(
549 + }).toErrorDev(
550 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
551 'Component uses getDerivedStateFromProps() but also contains the following legacy lifecycles:\n' +
552 ' componentWillMount\n' +
@@ -555,7 +555,7 @@ describe('create-react-class-integration', () => {
555 'The above lifecycles should be removed. Learn more about this warning here:\n' +
556 'https://fb.me/react-unsafe-component-lifecycles',
557 );
558 - }).toLowPriorityWarnDev(
558 + }).toWarnDev(
559 [
560 'componentWillMount has been renamed',
561 'componentWillReceiveProps has been renamed',
@@ -589,7 +589,7 @@ describe('create-react-class-integration', () => {
589 expect(() => {
590 expect(() => {
591 ReactDOM.render(<Component />, document.createElement('div'));
592 - }).toWarnDev(
592 + }).toErrorDev(
593 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
594 'Component uses getSnapshotBeforeUpdate() but also contains the following legacy lifecycles:\n' +
595 ' componentWillMount\n' +
@@ -598,7 +598,7 @@ describe('create-react-class-integration', () => {
598 'The above lifecycles should be removed. Learn more about this warning here:\n' +
599 'https://fb.me/react-unsafe-component-lifecycles',
600 );
601 - }).toLowPriorityWarnDev(
601 + }).toWarnDev(
602 [
603 'componentWillMount has been renamed',
604 'componentWillReceiveProps has been renamed',
@@ -641,9 +641,7 @@ describe('create-react-class-integration', () => {
641 });
642
643 const div = document.createElement('div');
644 - expect(() =>
645 - ReactDOM.render(<Component foo="bar" />, div),
646 - ).toLowPriorityWarnDev(
644 + expect(() => ReactDOM.render(<Component foo="bar" />, div)).toWarnDev(
645 [
646 'componentWillMount has been renamed',
647 'componentWillReceiveProps has been renamed',
@@ -719,7 +717,7 @@ describe('create-react-class-integration', () => {
717
718 const container = document.createElement('div');
719
722 - expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
720 + expect(() => ReactDOM.render(<Component />, container)).toErrorDev(
721 'Warning: MyComponent: isMounted is deprecated. Instead, make sure to ' +
722 'clean up subscriptions and pending requests in componentWillUnmount ' +
723 'to prevent memory leaks.',
packages/react/src/__tests__/forwardRef-test.js
+11 -11
@@ -118,7 +118,7 @@ describe('forwardRef', () => {
118
119 expect(() =>
120 ReactNoop.render(<RefForwardingComponent ref={ref} optional="foo" />),
121 - ).toWarnDev(
121 + ).toErrorDev(
122 'Warning: Failed prop type: The prop `required` is marked as required in ' +
123 '`ForwardRef(NamedFunction)`, but its value is `undefined`.\n' +
124 ' in ForwardRef(NamedFunction) (at **)',
@@ -126,22 +126,22 @@ describe('forwardRef', () => {
126 });
127
128 it('should warn if not provided a callback during creation', () => {
129 - expect(() => React.forwardRef(undefined)).toWarnDev(
129 + expect(() => React.forwardRef(undefined)).toErrorDev(
130 'forwardRef requires a render function but was given undefined.',
131 {withoutStack: true},
132 );
133 - expect(() => React.forwardRef(null)).toWarnDev(
133 + expect(() => React.forwardRef(null)).toErrorDev(
134 'forwardRef requires a render function but was given null.',
135 {withoutStack: true},
136 );
137 - expect(() => React.forwardRef('foo')).toWarnDev(
137 + expect(() => React.forwardRef('foo')).toErrorDev(
138 'forwardRef requires a render function but was given string.',
139 {withoutStack: true},
140 );
141 });
142
143 it('should warn if no render function is provided', () => {
144 - expect(React.forwardRef).toWarnDev(
144 + expect(React.forwardRef).toErrorDev(
145 'forwardRef requires a render function but was given undefined.',
146 {withoutStack: true},
147 );
@@ -158,12 +158,12 @@ describe('forwardRef', () => {
158 }
159 renderWithDefaultProps.defaultProps = {};
160
161 - expect(() => React.forwardRef(renderWithPropTypes)).toWarnDev(
161 + expect(() => React.forwardRef(renderWithPropTypes)).toErrorDev(
162 'forwardRef render functions do not support propTypes or defaultProps. ' +
163 'Did you accidentally pass a React component?',
164 {withoutStack: true},
165 );
166 - expect(() => React.forwardRef(renderWithDefaultProps)).toWarnDev(
166 + expect(() => React.forwardRef(renderWithDefaultProps)).toErrorDev(
167 'forwardRef render functions do not support propTypes or defaultProps. ' +
168 'Did you accidentally pass a React component?',
169 {withoutStack: true},
@@ -179,7 +179,7 @@ describe('forwardRef', () => {
179 it('should warn if the render function provided does not use the forwarded ref parameter', () => {
180 const arityOfOne = props => <div {...props} />;
181
182 - expect(() => React.forwardRef(arityOfOne)).toWarnDev(
182 + expect(() => React.forwardRef(arityOfOne)).toErrorDev(
183 'forwardRef render functions accept exactly two parameters: props and ref. ' +
184 'Did you forget to use the ref parameter?',
185 {withoutStack: true},
@@ -194,7 +194,7 @@ describe('forwardRef', () => {
194 it('should warn if the render function provided expects to use more than two parameters', () => {
195 const arityOfThree = (props, ref, x) => <div {...props} ref={ref} x={x} />;
196
197 - expect(() => React.forwardRef(arityOfThree)).toWarnDev(
197 + expect(() => React.forwardRef(arityOfThree)).toErrorDev(
198 'forwardRef render functions accept exactly two parameters: props and ref. ' +
199 'Any additional parameter will be undefined.',
200 {withoutStack: true},
@@ -223,7 +223,7 @@ describe('forwardRef', () => {
223
224 expect(() =>
225 ReactNoop.render(<RefForwardingComponent ref={ref} optional="foo" />),
226 - ).toWarnDev(
226 + ).toErrorDev(
227 'Warning: Failed prop type: The prop `required` is marked as required in ' +
228 '`Foo`, but its value is `undefined`.\n' +
229 ' in Foo (at **)',
@@ -364,7 +364,7 @@ describe('forwardRef', () => {
364 return null;
365 }),
366 );
367 - }).toWarnDev(
367 + }).toErrorDev(
368 [
369 'Warning: forwardRef requires a render function but received a `memo` ' +
370 'component. Instead of forwardRef(memo(...)), use ' +
scripts/jest/matchers/__tests__/toWarnDev-test.js
+55 -55
@@ -9,13 +9,13 @@
9
10 'use strict';
11
12 -describe('toWarnDev', () => {
12 +describe('toErrorDev', () => {
13 it('does not fail if a warning contains a stack', () => {
14 expect(() => {
15 if (__DEV__) {
16 console.error('Hello\n in div');
17 }
18 - }).toWarnDev('Hello');
18 + }).toErrorDev('Hello');
19 });
20
21 it('does not fail if all warnings contain a stack', () => {
@@ -25,7 +25,7 @@ describe('toWarnDev', () => {
25 console.error('Good day\n in div');
26 console.error('Bye\n in div');
27 }
28 - }).toWarnDev(['Hello', 'Good day', 'Bye']);
28 + }).toErrorDev(['Hello', 'Good day', 'Bye']);
29 });
30
31 it('does not fail if warnings without stack explicitly opt out', () => {
@@ -33,14 +33,14 @@ describe('toWarnDev', () => {
33 if (__DEV__) {
34 console.error('Hello');
35 }
36 - }).toWarnDev('Hello', {withoutStack: true});
36 + }).toErrorDev('Hello', {withoutStack: true});
37 expect(() => {
38 if (__DEV__) {
39 console.error('Hello');
40 console.error('Good day');
41 console.error('Bye');
42 }
43 - }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
43 + }).toErrorDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
44 });
45
46 it('does not fail when expected stack-less warning number matches the actual one', () => {
@@ -50,7 +50,7 @@ describe('toWarnDev', () => {
50 console.error('Good day');
51 console.error('Bye\n in div');
52 }
53 - }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: 1});
53 + }).toErrorDev(['Hello', 'Good day', 'Bye'], {withoutStack: 1});
54 });
55
56 if (__DEV__) {
@@ -71,7 +71,7 @@ describe('toWarnDev', () => {
71 expectToWarnAndToThrow(() => {
72 expect(() => {
73 console.error('Hello');
74 - }).toWarnDev('Hello');
74 + }).toErrorDev('Hello');
75 }, 'Received warning unexpectedly does not include a component stack');
76 });
77
@@ -81,28 +81,28 @@ describe('toWarnDev', () => {
81 console.error('Hello\n in div');
82 console.error('Good day\n in div');
83 console.error('Bye');
84 - }).toWarnDev(['Hello', 'Good day', 'Bye']);
84 + }).toErrorDev(['Hello', 'Good day', 'Bye']);
85 }, 'Received warning unexpectedly does not include a component stack');
86 expectToWarnAndToThrow(() => {
87 expect(() => {
88 console.error('Hello');
89 console.error('Good day\n in div');
90 console.error('Bye\n in div');
91 - }).toWarnDev(['Hello', 'Good day', 'Bye']);
91 + }).toErrorDev(['Hello', 'Good day', 'Bye']);
92 }, 'Received warning unexpectedly does not include a component stack');
93 expectToWarnAndToThrow(() => {
94 expect(() => {
95 console.error('Hello\n in div');
96 console.error('Good day');
97 console.error('Bye\n in div');
98 - }).toWarnDev(['Hello', 'Good day', 'Bye']);
98 + }).toErrorDev(['Hello', 'Good day', 'Bye']);
99 }, 'Received warning unexpectedly does not include a component stack');
100 expectToWarnAndToThrow(() => {
101 expect(() => {
102 console.error('Hello');
103 console.error('Good day');
104 console.error('Bye');
105 - }).toWarnDev(['Hello', 'Good day', 'Bye']);
105 + }).toErrorDev(['Hello', 'Good day', 'Bye']);
106 }, 'Received warning unexpectedly does not include a component stack');
107 });
108
@@ -110,14 +110,14 @@ describe('toWarnDev', () => {
110 expectToWarnAndToThrow(() => {
111 expect(() => {
112 console.error('Hello\n in div');
113 - }).toWarnDev('Hello', {withoutStack: true});
113 + }).toErrorDev('Hello', {withoutStack: true});
114 }, 'Received warning unexpectedly includes a component stack');
115 expectToWarnAndToThrow(() => {
116 expect(() => {
117 console.error('Hello\n in div');
118 console.error('Good day');
119 console.error('Bye\n in div');
120 - }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
120 + }).toErrorDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
121 }, 'Received warning unexpectedly includes a component stack');
122 });
123
@@ -127,7 +127,7 @@ describe('toWarnDev', () => {
127 console.error('Hello\n in div');
128 console.error('Good day');
129 console.error('Bye\n in div');
130 - }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: 4});
130 + }).toErrorDev(['Hello', 'Good day', 'Bye'], {withoutStack: 4});
131 }, 'Expected 4 warnings without a component stack but received 1');
132 });
133
@@ -135,17 +135,17 @@ describe('toWarnDev', () => {
135 expectToWarnAndToThrow(() => {
136 expect(() => {
137 console.error('Hi');
138 - }).toWarnDev('Hi', {withoutStack: null});
138 + }).toErrorDev('Hi', {withoutStack: null});
139 }, 'Instead received object');
140 expectToWarnAndToThrow(() => {
141 expect(() => {
142 console.error('Hi');
143 - }).toWarnDev('Hi', {withoutStack: {}});
143 + }).toErrorDev('Hi', {withoutStack: {}});
144 }, 'Instead received object');
145 expectToWarnAndToThrow(() => {
146 expect(() => {
147 console.error('Hi');
148 - }).toWarnDev('Hi', {withoutStack: 'haha'});
148 + }).toErrorDev('Hi', {withoutStack: 'haha'});
149 }, 'Instead received string');
150 });
151
@@ -153,13 +153,13 @@ describe('toWarnDev', () => {
153 expectToWarnAndToThrow(() => {
154 expect(() => {
155 console.error('Hi %s', 'Sara', 'extra');
156 - }).toWarnDev('Hi', {withoutStack: true});
156 + }).toErrorDev('Hi', {withoutStack: true});
157 }, 'Received 2 arguments for a message with 1 placeholders');
158
159 expectToWarnAndToThrow(() => {
160 expect(() => {
161 console.error('Hi %s');
162 - }).toWarnDev('Hi', {withoutStack: true});
162 + }).toErrorDev('Hi', {withoutStack: true});
163 }, 'Received 0 arguments for a message with 1 placeholders');
164 });
165
@@ -167,7 +167,7 @@ describe('toWarnDev', () => {
167 expectToWarnAndToThrow(() => {
168 expect(() => {
169 console.error('Hi %s%s', '\n in div', '\n in div');
170 - }).toWarnDev('Hi');
170 + }).toErrorDev('Hi');
171 }, 'Received more than one component stack for a warning');
172 });
173
@@ -175,28 +175,28 @@ describe('toWarnDev', () => {
175 expectToWarnAndToThrow(() => {
176 expect(() => {
177 console.error('Hi \n in div');
178 - }).toWarnDev('Hi', 'Bye');
179 - }, 'toWarnDev() second argument, when present, should be an object');
178 + }).toErrorDev('Hi', 'Bye');
179 + }, 'toErrorDev() second argument, when present, should be an object');
180 expectToWarnAndToThrow(() => {
181 expect(() => {
182 console.error('Hi \n in div');
183 console.error('Bye \n in div');
184 - }).toWarnDev('Hi', 'Bye');
185 - }, 'toWarnDev() second argument, when present, should be an object');
184 + }).toErrorDev('Hi', 'Bye');
185 + }, 'toErrorDev() second argument, when present, should be an object');
186 expectToWarnAndToThrow(() => {
187 expect(() => {
188 console.error('Hi \n in div');
189 console.error('Wow \n in div');
190 console.error('Bye \n in div');
191 - }).toWarnDev('Hi', 'Bye');
192 - }, 'toWarnDev() second argument, when present, should be an object');
191 + }).toErrorDev('Hi', 'Bye');
192 + }, 'toErrorDev() second argument, when present, should be an object');
193 expectToWarnAndToThrow(() => {
194 expect(() => {
195 console.error('Hi \n in div');
196 console.error('Wow \n in div');
197 console.error('Bye \n in div');
198 - }).toWarnDev('Hi', 'Wow', 'Bye');
199 - }, 'toWarnDev() second argument, when present, should be an object');
198 + }).toErrorDev('Hi', 'Wow', 'Bye');
199 + }, 'toErrorDev() second argument, when present, should be an object');
200 });
201
202 it('fails on more than two arguments', () => {
@@ -205,19 +205,19 @@ describe('toWarnDev', () => {
205 console.error('Hi \n in div');
206 console.error('Wow \n in div');
207 console.error('Bye \n in div');
208 - }).toWarnDev('Hi', undefined, 'Bye');
209 - }, 'toWarnDev() received more than two arguments.');
208 + }).toErrorDev('Hi', undefined, 'Bye');
209 + }, 'toErrorDev() received more than two arguments.');
210 });
211 }
212 });
213
214 -describe('toLowPriorityWarnDev', () => {
214 +describe('toWarnDev', () => {
215 it('does not fail if a warning contains a stack', () => {
216 expect(() => {
217 if (__DEV__) {
218 console.warn('Hello\n in div');
219 }
220 - }).toLowPriorityWarnDev('Hello');
220 + }).toWarnDev('Hello');
221 });
222
223 it('does not fail if all warnings contain a stack', () => {
@@ -227,7 +227,7 @@ describe('toLowPriorityWarnDev', () => {
227 console.warn('Good day\n in div');
228 console.warn('Bye\n in div');
229 }
230 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye']);
230 + }).toWarnDev(['Hello', 'Good day', 'Bye']);
231 });
232
233 it('does not fail if warnings without stack explicitly opt out', () => {
@@ -235,14 +235,14 @@ describe('toLowPriorityWarnDev', () => {
235 if (__DEV__) {
236 console.warn('Hello');
237 }
238 - }).toLowPriorityWarnDev('Hello', {withoutStack: true});
238 + }).toWarnDev('Hello', {withoutStack: true});
239 expect(() => {
240 if (__DEV__) {
241 console.warn('Hello');
242 console.warn('Good day');
243 console.warn('Bye');
244 }
245 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
245 + }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: true});
246 });
247
248 it('does not fail when expected stack-less warning number matches the actual one', () => {
@@ -252,7 +252,7 @@ describe('toLowPriorityWarnDev', () => {
252 console.warn('Good day');
253 console.warn('Bye\n in div');
254 }
255 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: 1});
255 + }).toWarnDev(['Hello', 'Good day', 'Bye'], {withoutStack: 1});
256 });
257
258 if (__DEV__) {
@@ -273,7 +273,7 @@ describe('toLowPriorityWarnDev', () => {
273 expectToWarnAndToThrow(() => {
274 expect(() => {
275 console.warn('Hello');
276 - }).toLowPriorityWarnDev('Hello');
276 + }).toWarnDev('Hello');
277 }, 'Received warning unexpectedly does not include a component stack');
278 });
279
@@ -283,28 +283,28 @@ describe('toLowPriorityWarnDev', () => {
283 console.warn('Hello\n in div');
284 console.warn('Good day\n in div');
285 console.warn('Bye');
286 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye']);
286 + }).toWarnDev(['Hello', 'Good day', 'Bye']);
287 }, 'Received warning unexpectedly does not include a component stack');
288 expectToWarnAndToThrow(() => {
289 expect(() => {
290 console.warn('Hello');
291 console.warn('Good day\n in div');
292 console.warn('Bye\n in div');
293 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye']);
293 + }).toWarnDev(['Hello', 'Good day', 'Bye']);
294 }, 'Received warning unexpectedly does not include a component stack');
295 expectToWarnAndToThrow(() => {
296 expect(() => {
297 console.warn('Hello\n in div');
298 console.warn('Good day');
299 console.warn('Bye\n in div');
300 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye']);
300 + }).toWarnDev(['Hello', 'Good day', 'Bye']);
301 }, 'Received warning unexpectedly does not include a component stack');
302 expectToWarnAndToThrow(() => {
303 expect(() => {
304 console.warn('Hello');
305 console.warn('Good day');
306 console.warn('Bye');
307 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye']);
307 + }).toWarnDev(['Hello', 'Good day', 'Bye']);
308 }, 'Received warning unexpectedly does not include a component stack');
309 });
310
@@ -312,14 +312,14 @@ describe('toLowPriorityWarnDev', () => {
312 expectToWarnAndToThrow(() => {
313 expect(() => {
314 console.warn('Hello\n in div');
315 - }).toLowPriorityWarnDev('Hello', {withoutStack: true});
315 + }).toWarnDev('Hello', {withoutStack: true});
316 }, 'Received warning unexpectedly includes a component stack');
317 expectToWarnAndToThrow(() => {
318 expect(() => {
319 console.warn('Hello\n in div');
320 console.warn('Good day');
321 console.warn('Bye\n in div');
322 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye'], {
322 + }).toWarnDev(['Hello', 'Good day', 'Bye'], {
323 withoutStack: true,
324 });
325 }, 'Received warning unexpectedly includes a component stack');
@@ -331,7 +331,7 @@ describe('toLowPriorityWarnDev', () => {
331 console.warn('Hello\n in div');
332 console.warn('Good day');
333 console.warn('Bye\n in div');
334 - }).toLowPriorityWarnDev(['Hello', 'Good day', 'Bye'], {
334 + }).toWarnDev(['Hello', 'Good day', 'Bye'], {
335 withoutStack: 4,
336 });
337 }, 'Expected 4 warnings without a component stack but received 1');
@@ -341,17 +341,17 @@ describe('toLowPriorityWarnDev', () => {
341 expectToWarnAndToThrow(() => {
342 expect(() => {
343 console.warn('Hi');
344 - }).toLowPriorityWarnDev('Hi', {withoutStack: null});
344 + }).toWarnDev('Hi', {withoutStack: null});
345 }, 'Instead received object');
346 expectToWarnAndToThrow(() => {
347 expect(() => {
348 console.warn('Hi');
349 - }).toLowPriorityWarnDev('Hi', {withoutStack: {}});
349 + }).toWarnDev('Hi', {withoutStack: {}});
350 }, 'Instead received object');
351 expectToWarnAndToThrow(() => {
352 expect(() => {
353 console.warn('Hi');
354 - }).toLowPriorityWarnDev('Hi', {withoutStack: 'haha'});
354 + }).toWarnDev('Hi', {withoutStack: 'haha'});
355 }, 'Instead received string');
356 });
357
@@ -359,13 +359,13 @@ describe('toLowPriorityWarnDev', () => {
359 expectToWarnAndToThrow(() => {
360 expect(() => {
361 console.warn('Hi %s', 'Sara', 'extra');
362 - }).toLowPriorityWarnDev('Hi', {withoutStack: true});
362 + }).toWarnDev('Hi', {withoutStack: true});
363 }, 'Received 2 arguments for a message with 1 placeholders');
364
365 expectToWarnAndToThrow(() => {
366 expect(() => {
367 console.warn('Hi %s');
368 - }).toLowPriorityWarnDev('Hi', {withoutStack: true});
368 + }).toWarnDev('Hi', {withoutStack: true});
369 }, 'Received 0 arguments for a message with 1 placeholders');
370 });
371
@@ -373,7 +373,7 @@ describe('toLowPriorityWarnDev', () => {
373 expectToWarnAndToThrow(() => {
374 expect(() => {
375 console.warn('Hi %s%s', '\n in div', '\n in div');
376 - }).toLowPriorityWarnDev('Hi');
376 + }).toWarnDev('Hi');
377 }, 'Received more than one component stack for a warning');
378 });
379
@@ -381,27 +381,27 @@ describe('toLowPriorityWarnDev', () => {
381 expectToWarnAndToThrow(() => {
382 expect(() => {
383 console.warn('Hi \n in div');
384 - }).toLowPriorityWarnDev('Hi', 'Bye');
384 + }).toWarnDev('Hi', 'Bye');
385 }, 'toWarnDev() second argument, when present, should be an object');
386 expectToWarnAndToThrow(() => {
387 expect(() => {
388 console.warn('Hi \n in div');
389 console.warn('Bye \n in div');
390 - }).toLowPriorityWarnDev('Hi', 'Bye');
390 + }).toWarnDev('Hi', 'Bye');
391 }, 'toWarnDev() second argument, when present, should be an object');
392 expectToWarnAndToThrow(() => {
393 expect(() => {
394 console.warn('Hi \n in div');
395 console.warn('Wow \n in div');
396 console.warn('Bye \n in div');
397 - }).toLowPriorityWarnDev('Hi', 'Bye');
397 + }).toWarnDev('Hi', 'Bye');
398 }, 'toWarnDev() second argument, when present, should be an object');
399 expectToWarnAndToThrow(() => {
400 expect(() => {
401 console.warn('Hi \n in div');
402 console.warn('Wow \n in div');
403 console.warn('Bye \n in div');
404 - }).toLowPriorityWarnDev('Hi', 'Wow', 'Bye');
404 + }).toWarnDev('Hi', 'Wow', 'Bye');
405 }, 'toWarnDev() second argument, when present, should be an object');
406 });
407
@@ -411,7 +411,7 @@ describe('toLowPriorityWarnDev', () => {
411 console.warn('Hi \n in div');
412 console.warn('Wow \n in div');
413 console.warn('Bye \n in div');
414 - }).toLowPriorityWarnDev('Hi', undefined, 'Bye');
414 + }).toWarnDev('Hi', undefined, 'Bye');
415 }, 'toWarnDev() received more than two arguments.');
416 });
417 }
scripts/jest/matchers/toWarnDev.js
+10 -10
@@ -8,7 +8,7 @@ function normalizeCodeLocInfo(str) {
8 return str && str.replace(/at .+?:\d+/g, 'at **');
9 }
10
11 -const createMatcherFor = consoleMethod =>
11 +const createMatcherFor = (consoleMethod, matcherName) =>
12 function matcher(callback, expectedMessages, options = {}) {
13 if (__DEV__) {
14 // Warn about incorrect usage of matcher.
@@ -16,7 +16,7 @@ const createMatcherFor = consoleMethod =>
16 expectedMessages = [expectedMessages];
17 } else if (!Array.isArray(expectedMessages)) {
18 throw Error(
19 - `toWarnDev() requires a parameter of type string or an array of strings ` +
19 + `${matcherName}() requires a parameter of type string or an array of strings ` +
20 `but was given ${typeof expectedMessages}.`
21 );
22 }
@@ -25,14 +25,14 @@ const createMatcherFor = consoleMethod =>
25 (typeof options !== 'object' || Array.isArray(options))
26 ) {
27 throw new Error(
28 - 'toWarnDev() second argument, when present, should be an object. ' +
28 + `${matcherName}() second argument, when present, should be an object. ` +
29 'Did you forget to wrap the messages into an array?'
30 );
31 }
32 if (arguments.length > 3) {
33 // `matcher` comes from Jest, so it's more than 2 in practice
34 throw new Error(
35 - 'toWarnDev() received more than two arguments. ' +
35 + `${matcherName}() received more than two arguments. ` +
36 'Did you forget to wrap the messages into an array?'
37 );
38 }
@@ -195,8 +195,8 @@ const createMatcherFor = consoleMethod =>
195 `Received warning unexpectedly includes a component stack:\n ${this.utils.printReceived(
196 warningsWithComponentStack[0]
197 )}\nIf this warning intentionally includes the component stack, remove ` +
198 - `{withoutStack: true} from the toWarnDev() call. If you have a mix of ` +
199 - `warnings with and without stack in one toWarnDev() call, pass ` +
198 + `{withoutStack: true} from the ${matcherName}() call. If you have a mix of ` +
199 + `warnings with and without stack in one ${matcherName}() call, pass ` +
200 `{withoutStack: N} where N is the number of warnings without stacks.`,
201 pass: false,
202 };
@@ -210,13 +210,13 @@ const createMatcherFor = consoleMethod =>
210 `Received warning unexpectedly does not include a component stack:\n ${this.utils.printReceived(
211 warningsWithoutComponentStack[0]
212 )}\nIf this warning intentionally omits the component stack, add ` +
213 - `{withoutStack: true} to the toWarnDev() call.`,
213 + `{withoutStack: true} to the ${matcherName} call.`,
214 pass: false,
215 };
216 }
217 } else {
218 throw Error(
219 - `The second argument for toWarnDev(), when specified, must be an object. It may have a ` +
219 + `The second argument for ${matcherName}(), when specified, must be an object. It may have a ` +
220 `property called "withoutStack" whose value may be undefined, boolean, or a number. ` +
221 `Instead received ${typeof withoutStack}.`
222 );
@@ -258,6 +258,6 @@ const createMatcherFor = consoleMethod =>
258 };
259
260 module.exports = {
261 - toLowPriorityWarnDev: createMatcherFor('warn'),
262 - toWarnDev: createMatcherFor('error'),
261 + toWarnDev: createMatcherFor('warn', 'toWarnDev'),
262 + toErrorDev: createMatcherFor('error', 'toErrorDev'),
263 };
scripts/jest/typescript/jest.d.ts
+1 -1
@@ -21,8 +21,8 @@ interface Expect {
21 not: Expect
22 toThrow(message?: string): void
23 toThrowError(message?: string): void
24 + toErrorDev(message?: string | Array<string>, options?: any): void
25 toWarnDev(message?: string | Array<string>, options?: any): void
25 - toLowPriorityWarnDev(message?: string | Array<string>, options?: any): void
26 toBe(value: any): void
27 toEqual(value: any): void
28 toBeFalsy(): void