Skip to content

Commit

Permalink
Rename toWarnDev -> toErrorDev, toLowPriorityWarnDev -> toWarnDev (#1…
Browse files Browse the repository at this point in the history
…7605)

* Rename toWarnDev -> toErrorDev in tests

* Rename toWarnDev matcher implementation to toErrorDev

* Rename toLowPriorityWarnDev -> toWarnDev in tests and implementation
  • Loading branch information
gaearon committed Dec 16, 2019
1 parent 0cf22a5 commit 0b5a26a
Show file tree
Hide file tree
Showing 97 changed files with 766 additions and 776 deletions.
Expand Up @@ -452,7 +452,7 @@ describe('createSubscription', () => {
},
() => null,
);
}).toWarnDev('Subscription must specify a getCurrentValue function', {
}).toErrorDev('Subscription must specify a getCurrentValue function', {
withoutStack: true,
});
});
Expand All @@ -465,7 +465,7 @@ describe('createSubscription', () => {
},
() => null,
);
}).toWarnDev('Subscription must specify a subscribe function', {
}).toErrorDev('Subscription must specify a subscribe function', {
withoutStack: true,
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/react-art/src/__tests__/ReactART-test.js
Expand Up @@ -420,7 +420,7 @@ describe('ReactARTComponents', () => {
ReactTestRenderer.create(
<Circle stroke="green" strokeWidth={3} fill="blue" />,
),
).toWarnDev(
).toErrorDev(
'Warning: Failed prop type: The prop `radius` is marked as required in `Circle`, ' +
'but its value is `undefined`.' +
'\n in Circle (at **)',
Expand All @@ -437,7 +437,7 @@ describe('ReactARTComponents', () => {
it('should warn if width/height is missing on a Rectangle component', () => {
expect(() =>
ReactTestRenderer.create(<Rectangle stroke="green" fill="blue" />),
).toWarnDev([
).toErrorDev([
'Warning: Failed prop type: The prop `width` is marked as required in `Rectangle`, ' +
'but its value is `undefined`.' +
'\n in Rectangle (at **)',
Expand All @@ -462,7 +462,7 @@ describe('ReactARTComponents', () => {
});

it('should warn if outerRadius/startAngle/endAngle is missing on a Wedge component', () => {
expect(() => ReactTestRenderer.create(<Wedge fill="blue" />)).toWarnDev([
expect(() => ReactTestRenderer.create(<Wedge fill="blue" />)).toErrorDev([
'Warning: Failed prop type: The prop `outerRadius` is marked as required in `Wedge`, ' +
'but its value is `undefined`.' +
'\n in Wedge (at **)',
Expand Down
Expand Up @@ -172,7 +172,7 @@ describe('ReactCache', () => {
if (__DEV__) {
expect(() => {
expect(Scheduler).toFlushAndYield(['App', 'Loading...']);
}).toWarnDev([
}).toErrorDev([
'Invalid key type. Expected a string, number, symbol, or ' +
'boolean, but instead received: Hi,100\n\n' +
'To use non-primitive values as keys, you must pass a hash ' +
Expand Down
12 changes: 6 additions & 6 deletions packages/react-dom/src/__tests__/CSSPropertyOperations-test.js
Expand Up @@ -98,7 +98,7 @@ describe('CSSPropertyOperations', () => {

const root = document.createElement('div');

expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
'Warning: Unsupported style property background-color. Did you mean backgroundColor?' +
'\n in div (at **)' +
'\n in Comp (at **)',
Expand All @@ -121,7 +121,7 @@ describe('CSSPropertyOperations', () => {
const root = document.createElement('div');
ReactDOM.render(<Comp />, root);

expect(() => ReactDOM.render(<Comp style={styles} />, root)).toWarnDev([
expect(() => ReactDOM.render(<Comp style={styles} />, root)).toErrorDev([
'Warning: Unsupported style property -ms-transform. Did you mean msTransform?' +
'\n in div (at **)' +
'\n in Comp (at **)',
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('CSSPropertyOperations', () => {

const root = document.createElement('div');

expect(() => ReactDOM.render(<Comp />, root)).toWarnDev([
expect(() => ReactDOM.render(<Comp />, root)).toErrorDev([
// msTransform is correct already and shouldn't warn
'Warning: Unsupported vendor-prefixed style property oTransform. ' +
'Did you mean OTransform?' +
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('CSSPropertyOperations', () => {

const root = document.createElement('div');

expect(() => ReactDOM.render(<Comp />, root)).toWarnDev([
expect(() => ReactDOM.render(<Comp />, root)).toErrorDev([
"Warning: Style property values shouldn't contain a semicolon. " +
'Try "backgroundColor: blue" instead.' +
'\n in div (at **)' +
Expand All @@ -206,7 +206,7 @@ describe('CSSPropertyOperations', () => {

const root = document.createElement('div');

expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
'\n in div (at **)' +
'\n in Comp (at **)',
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('CSSPropertyOperations', () => {

const root = document.createElement('div');

expect(() => ReactDOM.render(<Comp />, root)).toWarnDev(
expect(() => ReactDOM.render(<Comp />, root)).toErrorDev(
'Warning: `Infinity` is an invalid value for the `fontSize` css style property.' +
'\n in div (at **)' +
'\n in Comp (at **)',
Expand Down
Expand Up @@ -183,7 +183,7 @@ describe('DOMPropertyOperations', () => {
<input type="text" onChange={function() {}} />,
container,
),
).toWarnDev(
).toErrorDev(
'A component is changing a controlled input of type text to be uncontrolled',
);
if (disableInputAttributeSyncing) {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/__tests__/EventPluginHub-test.js
Expand Up @@ -27,7 +27,7 @@ describe('EventPluginHub', () => {
node = ReactTestUtils.renderIntoDocument(
<div onClick="not a function" />,
);
}).toWarnDev(
}).toErrorDev(
'Expected `onClick` listener to be a function, instead got a value of `string` type.',
);
expect(() => ReactTestUtils.SimulateNative.click(node)).toThrowError(
Expand Down
10 changes: 5 additions & 5 deletions packages/react-dom/src/__tests__/ReactChildReconciler-test.js
Expand Up @@ -65,7 +65,7 @@ describe('ReactChildReconciler', () => {
<h1>{iterableFunction}</h1>
</div>,
);
}).toWarnDev('Functions are not valid as a React child');
}).toErrorDev('Functions are not valid as a React child');

expect(node.innerHTML).toContain(''); // h1
});
Expand All @@ -77,7 +77,7 @@ describe('ReactChildReconciler', () => {
}
}

expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
'Keys should be unique so that components maintain their identity ' +
'across updates. Non-unique keys may cause children to be ' +
'duplicated and/or omitted — the behavior is unsupported and ' +
Expand All @@ -104,7 +104,7 @@ describe('ReactChildReconciler', () => {
}
}

expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toErrorDev(
'Encountered two children with the same key, `1`. ' +
'Keys should be unique so that components maintain their identity ' +
'across updates. Non-unique keys may cause children to be ' +
Expand All @@ -124,7 +124,7 @@ describe('ReactChildReconciler', () => {
}
}

expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
'Keys should be unique so that components maintain their identity ' +
'across updates. Non-unique keys may cause children to be ' +
'duplicated and/or omitted — the behavior is unsupported and ' +
Expand All @@ -151,7 +151,7 @@ describe('ReactChildReconciler', () => {
}
}

expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<GrandParent />)).toErrorDev(
'Encountered two children with the same key, `1`. ' +
'Keys should be unique so that components maintain their identity ' +
'across updates. Non-unique keys may cause children to be ' +
Expand Down
14 changes: 7 additions & 7 deletions packages/react-dom/src/__tests__/ReactComponent-test.js
Expand Up @@ -397,7 +397,7 @@ describe('ReactComponent', () => {
it('throws usefully when rendering badly-typed elements', () => {
const X = undefined;
expect(() => {
expect(() => ReactTestUtils.renderIntoDocument(<X />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<X />)).toErrorDev(
'React.createElement: type is invalid -- expected a string (for built-in components) ' +
'or a class/function (for composite components) but got: undefined.',
);
Expand All @@ -412,7 +412,7 @@ describe('ReactComponent', () => {

const Y = null;
expect(() => {
expect(() => ReactTestUtils.renderIntoDocument(<Y />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<Y />)).toErrorDev(
'React.createElement: type is invalid -- expected a string (for built-in components) ' +
'or a class/function (for composite components) but got: null.',
);
Expand Down Expand Up @@ -442,7 +442,7 @@ describe('ReactComponent', () => {
}

expect(() => {
expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toWarnDev(
expect(() => ReactTestUtils.renderIntoDocument(<Foo />)).toErrorDev(
'React.createElement: type is invalid -- expected a string (for built-in components) ' +
'or a class/function (for composite components) but got: undefined.',
);
Expand Down Expand Up @@ -572,7 +572,7 @@ describe('ReactComponent', () => {
return Foo;
}
const container = document.createElement('div');
expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
'Warning: Functions are not valid as a React child. This may happen if ' +
'you return a Component instead of <Component /> from render. ' +
'Or maybe you meant to call this function rather than return it.\n' +
Expand All @@ -587,7 +587,7 @@ describe('ReactComponent', () => {
}
}
const container = document.createElement('div');
expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
'Warning: Functions are not valid as a React child. This may happen if ' +
'you return a Component instead of <Component /> from render. ' +
'Or maybe you meant to call this function rather than return it.\n' +
Expand All @@ -604,7 +604,7 @@ describe('ReactComponent', () => {
);
}
const container = document.createElement('div');
expect(() => ReactDOM.render(<Foo />, container)).toWarnDev(
expect(() => ReactDOM.render(<Foo />, container)).toErrorDev(
'Warning: Functions are not valid as a React child. This may happen if ' +
'you return a Component instead of <Component /> from render. ' +
'Or maybe you meant to call this function rather than return it.\n' +
Expand Down Expand Up @@ -649,7 +649,7 @@ describe('ReactComponent', () => {
let component;
expect(() => {
component = ReactDOM.render(<Foo />, container);
}).toWarnDev([
}).toErrorDev([
'Warning: Functions are not valid as a React child. This may happen if ' +
'you return a Component instead of <Component /> from render. ' +
'Or maybe you meant to call this function rather than return it.\n' +
Expand Down

0 comments on commit 0b5a26a

Please sign in to comment.