@samitouri / QOS-React-2 / commits / cdaea311a3

Remove "Invariant Violation: " from Invariant Error Messages

Timothy Yung committed Oct 15, 2015 at 10:19 UTC cdaea311a3d99137578f63d0c40836a40c6ea2db
29 files changed +148 -193
src/addons/__tests__/ReactFragment-test.js
+12 -13
@@ -32,10 +32,10 @@ describe('ReactFragment', function() {
32 var element = <div>{[children]}</div>;
33 var container = document.createElement('div');
34 expect(() => ReactDOM.render(element, container)).toThrow(
35 - 'Invariant Violation: Objects are not valid as a React child (found: ' +
36 - 'object with keys {x, y, z}). If you meant to render a collection of ' +
37 - 'children, use an array instead or wrap the object using ' +
38 - 'createFragment(object) from the React add-ons.'
35 + 'Objects are not valid as a React child (found: object with keys ' +
36 + '{x, y, z}). If you meant to render a collection of children, use an ' +
37 + 'array instead or wrap the object using createFragment(object) from ' +
38 + 'the React add-ons.'
39 );
40 });
41
@@ -52,11 +52,10 @@ describe('ReactFragment', function() {
52 }
53 var container = document.createElement('div');
54 expect(() => ReactDOM.render(<Foo />, container)).toThrow(
55 - 'Invariant Violation: Objects are not valid as a React child (found: ' +
56 - 'object with keys {a, b, c}). If you meant to render a collection of ' +
57 - 'children, use an array instead or wrap the object using ' +
58 - 'createFragment(object) from the React add-ons. Check the render ' +
59 - 'method of `Foo`.'
55 + 'Objects are not valid as a React child (found: object with keys ' +
56 + '{a, b, c}). If you meant to render a collection of children, use an ' +
57 + 'array instead or wrap the object using createFragment(object) from ' +
58 + 'the React add-ons. Check the render method of `Foo`.'
59 );
60 });
61
@@ -64,10 +63,10 @@ describe('ReactFragment', function() {
63 var oldEl = {_isReactElement: true, type: 'span', props: {}};
64 var container = document.createElement('div');
65 expect(() => ReactDOM.render(<div>{oldEl}</div>, container)).toThrow(
67 - 'Invariant Violation: Objects are not valid as a React child (found: ' +
68 - 'object with keys {_isReactElement, type, props}). It looks like ' +
69 - 'you\'re using an element created by a different version of React. ' +
70 - 'Make sure to use only one copy of React.'
66 + 'Objects are not valid as a React child (found: object with keys ' +
67 + '{_isReactElement, type, props}). It looks like you\'re using an ' +
68 + 'element created by a different version of React. Make sure to use ' +
69 + 'only one copy of React.'
70 );
71 });
72
src/addons/__tests__/renderSubtreeIntoContainer-test.js
+1 -2
@@ -88,8 +88,7 @@ describe('renderSubtreeIntoContainer', function() {
88 componentDidMount: function() {
89 expect(function() {
90 renderSubtreeIntoContainer(<Parent />, <Component />, portal);
91 - }).toThrow('Invariant Violation: parentComponent' +
92 - 'must be a valid React Component');
91 + }).toThrow('parentComponentmust be a valid React Component');
92 },
93 });
94 });
src/addons/__tests__/update-test.js
+17 -24
@@ -17,53 +17,47 @@ describe('update', function() {
17 it('should support push', function() {
18 expect(update([1], {$push: [7]})).toEqual([1, 7]);
19 expect(update.bind(null, [], {$push: 7})).toThrow(
20 - 'Invariant Violation: update(): expected spec of $push to be an ' +
21 - 'array; got 7. Did you forget to wrap your parameter in an array?'
20 + 'update(): expected spec of $push to be an array; got 7. Did you ' +
21 + 'forget to wrap your parameter in an array?'
22 );
23 expect(update.bind(null, 1, {$push: 7})).toThrow(
24 - 'Invariant Violation: update(): expected target of $push to be an ' +
25 - 'array; got 1.'
24 + 'update(): expected target of $push to be an array; got 1.'
25 );
26 });
27
28 it('should support unshift', function() {
29 expect(update([1], {$unshift: [7]})).toEqual([7, 1]);
30 expect(update.bind(null, [], {$unshift: 7})).toThrow(
32 - 'Invariant Violation: update(): expected spec of $unshift to be an ' +
33 - 'array; got 7. Did you forget to wrap your parameter in an array?'
31 + 'update(): expected spec of $unshift to be an array; got 7. Did you ' +
32 + 'forget to wrap your parameter in an array?'
33 );
34 expect(update.bind(null, 1, {$unshift: 7})).toThrow(
36 - 'Invariant Violation: update(): expected target of $unshift to be an ' +
37 - 'array; got 1.'
35 + 'update(): expected target of $unshift to be an array; got 1.'
36 );
37 });
38
39 it('should support splice', function() {
40 expect(update([1, 4, 3], {$splice: [[1, 1, 2]]})).toEqual([1, 2, 3]);
41 expect(update.bind(null, [], {$splice: 1})).toThrow(
44 - 'Invariant Violation: update(): expected spec of $splice to be an ' +
45 - 'array of arrays; got 1. Did you forget to wrap your parameters in an ' +
46 - 'array?'
42 + 'update(): expected spec of $splice to be an array of arrays; got 1. ' +
43 + 'Did you forget to wrap your parameters in an array?'
44 );
45 expect(update.bind(null, [], {$splice: [1]})).toThrow(
49 - 'Invariant Violation: update(): expected spec of $splice to be an ' +
50 - 'array of arrays; got 1. Did you forget to wrap your parameters in an ' +
51 - 'array?'
46 + 'update(): expected spec of $splice to be an array of arrays; got 1. ' +
47 + 'Did you forget to wrap your parameters in an array?'
48 );
49 expect(update.bind(null, 1, {$splice: 7})).toThrow(
54 - 'Invariant Violation: Expected $splice target to be an array; got 1'
50 + 'Expected $splice target to be an array; got 1'
51 );
52 });
53
54 it('should support merge', function() {
55 expect(update({a: 'b'}, {$merge: {c: 'd'}})).toEqual({a: 'b', c: 'd'});
56 expect(update.bind(null, {}, {$merge: 7})).toThrow(
61 - 'Invariant Violation: update(): $merge expects a spec of type ' +
62 - '\'object\'; got 7'
57 + 'update(): $merge expects a spec of type \'object\'; got 7'
58 );
59 expect(update.bind(null, 7, {$merge: {a: 'b'}})).toThrow(
65 - 'Invariant Violation: update(): $merge expects a target of type ' +
66 - '\'object\'; got 7'
60 + 'update(): $merge expects a target of type \'object\'; got 7'
61 );
62 });
63
@@ -74,8 +68,7 @@ describe('update', function() {
68 it('should support apply', function() {
69 expect(update(2, {$apply: (x) => x * 2})).toEqual(4);
70 expect(update.bind(null, 2, {$apply: 123})).toThrow(
77 - 'Invariant Violation: update(): expected spec of $apply to be a ' +
78 - 'function; got 123.'
71 + 'update(): expected spec of $apply to be a function; got 123.'
72 );
73 });
74
@@ -88,9 +81,9 @@ describe('update', function() {
81
82 it('should require a command', function() {
83 expect(update.bind(null, {a: 'b'}, {a: 'c'})).toThrow(
91 - 'Invariant Violation: update(): You provided a key path to update() ' +
92 - 'that did not contain one of $push, $unshift, $splice, $set, $merge, ' +
93 - '$apply. Did you forget to include {$set: ...}?'
84 + 'update(): You provided a key path to update() that did not contain ' +
85 + 'one of $push, $unshift, $splice, $set, $merge, $apply. Did you ' +
86 + 'forget to include {$set: ...}?'
87 );
88 });
89
src/isomorphic/classic/class/__tests__/ReactClass-test.js
+6 -8
@@ -30,8 +30,7 @@ describe('ReactClass-spec', function() {
30 expect(function() {
31 React.createClass({});
32 }).toThrow(
33 - 'Invariant Violation: createClass(...): Class specification must ' +
34 - 'implement a `render` method.'
33 + 'createClass(...): Class specification must implement a `render` method.'
34 );
35 });
36
@@ -197,10 +196,10 @@ describe('ReactClass-spec', function() {
196 },
197 });
198 }).toThrow(
200 - 'Invariant Violation: ReactClass: You are attempting to ' +
201 - 'define a reserved property, `getDefaultProps`, that shouldn\'t be on ' +
202 - 'the "statics" key. Define it as an instance property instead; it ' +
203 - 'will still be accessible on the constructor.'
199 + 'ReactClass: You are attempting to define a reserved property, ' +
200 + '`getDefaultProps`, that shouldn\'t be on the "statics" key. Define ' +
201 + 'it as an instance property instead; it will still be accessible on ' +
202 + 'the constructor.'
203 );
204 });
205
@@ -331,8 +330,7 @@ describe('ReactClass-spec', function() {
330 expect(function() {
331 instance = ReactTestUtils.renderIntoDocument(instance);
332 }).toThrow(
334 - 'Invariant Violation: Component.getInitialState(): ' +
335 - 'must return an object or null'
333 + 'Component.getInitialState(): must return an object or null'
334 );
335 });
336 });
src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js
+12 -16
@@ -208,11 +208,10 @@ describe('ReactClass-mixin', function() {
208 expect(function() {
209 instance = ReactTestUtils.renderIntoDocument(instance);
210 }).toThrow(
211 - 'Invariant Violation: mergeIntoWithNoDuplicateKeys(): ' +
212 - 'Tried to merge two objects with the same key: `x`. This conflict ' +
213 - 'may be due to a mixin; in particular, this may be caused by two ' +
214 - 'getInitialState() or getDefaultProps() methods returning objects ' +
215 - 'with clashing keys.'
211 + 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the ' +
212 + 'same key: `x`. This conflict may be due to a mixin; in particular, ' +
213 + 'this may be caused by two getInitialState() or getDefaultProps() ' +
214 + 'methods returning objects with clashing keys.'
215 );
216 });
217
@@ -280,9 +279,8 @@ describe('ReactClass-mixin', function() {
279 },
280 });
281 }).toThrow(
283 - 'Invariant Violation: ReactClass: You are attempting to ' +
284 - 'define `abc` on your component more than once. This conflict may be ' +
285 - 'due to a mixin.'
282 + 'ReactClass: You are attempting to define `abc` on your component more ' +
283 + 'than once. This conflict may be due to a mixin.'
284 );
285 });
286
@@ -309,9 +307,8 @@ describe('ReactClass-mixin', function() {
307 },
308 });
309 }).toThrow(
312 - 'Invariant Violation: ReactClass: You are attempting to ' +
313 - 'define `abc` on your component more than once. This conflict may be ' +
314 - 'due to a mixin.'
310 + 'ReactClass: You are attempting to define `abc` on your component ' +
311 + 'more than once. This conflict may be due to a mixin.'
312 );
313 });
314
@@ -325,8 +322,8 @@ describe('ReactClass-mixin', function() {
322 },
323 });
324 }).toThrow(
328 - 'Invariant Violation: ReactClass: You\'re attempting to ' +
329 - 'use a component as a mixin. Instead, just use a regular object.'
325 + 'ReactClass: You\'re attempting to use a component as a mixin. ' +
326 + 'Instead, just use a regular object.'
327 );
328 });
329
@@ -346,9 +343,8 @@ describe('ReactClass-mixin', function() {
343 },
344 });
345 }).toThrow(
349 - 'Invariant Violation: ReactClass: You\'re attempting to ' +
350 - 'use a component class or function as a mixin. Instead, just use a ' +
351 - 'regular object.'
346 + 'ReactClass: You\'re attempting to use a component class or function ' +
347 + 'as a mixin. Instead, just use a regular object.'
348 );
349 });
350
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
+3 -3
@@ -287,9 +287,9 @@ describe('ReactElementValidator', function() {
287 expect(function() {
288 ReactTestUtils.renderIntoDocument(React.createElement(ParentComp));
289 }).toThrow(
290 - 'Invariant Violation: Element type is invalid: expected a string (for ' +
291 - 'built-in components) or a class/function (for composite components) ' +
292 - 'but got: null. Check the render method of `ParentComp`.'
290 + 'Element type is invalid: expected a string (for built-in components) ' +
291 + 'or a class/function (for composite components) but got: null. Check ' +
292 + 'the render method of `ParentComp`.'
293 );
294 expect(console.error.calls.length).toBe(1);
295 expect(console.error.argsForCall[0][0]).toBe(
src/isomorphic/modern/class/__tests__/ReactCoffeeScriptClass-test.coffee
+1 -1
@@ -154,7 +154,7 @@ describe 'ReactCoffeeScriptClass', ->
154 expect(->
155 test React.createElement(Foo), 'span', ''
156 ).toThrow(
157 - 'Invariant Violation: Foo.state: must be set to an object or null'
157 + 'Foo.state: must be set to an object or null'
158 )
159
160 it 'should render with null in the initial state property', ->
src/isomorphic/modern/class/__tests__/ReactES6Class-test.js
+1 -2
@@ -176,8 +176,7 @@ describe('ReactES6Class', function() {
176 }
177 }
178 expect(() => test(<Foo />, 'span', '')).toThrow(
179 - 'Invariant Violation: Foo.state: ' +
180 - 'must be set to an object or null'
179 + 'Foo.state: must be set to an object or null'
180 );
181 });
182 });
src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts
+3 -6
@@ -361,18 +361,15 @@ describe('ReactTypeScriptClass', function() {
361 it('should throw with non-object in the initial state property', function() {
362 expect(() => test(React.createElement(ArrayState), 'span', ''))
363 .toThrow(
364 - 'Invariant Violation: ArrayState.state: ' +
365 - 'must be set to an object or null'
364 + 'ArrayState.state: must be set to an object or null'
365 );
366 expect(() => test(React.createElement(StringState), 'span', ''))
367 .toThrow(
369 - 'Invariant Violation: StringState.state: ' +
370 - 'must be set to an object or null'
368 + 'StringState.state: must be set to an object or null'
369 );
370 expect(() => test(React.createElement(NumberState), 'span', ''))
371 .toThrow(
374 - 'Invariant Violation: NumberState.state: ' +
375 - 'must be set to an object or null'
372 + 'NumberState.state: must be set to an object or null'
373 );
374 });
375
src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js
+4 -4
@@ -301,8 +301,8 @@ describe('ReactJSXElementValidator', function() {
301 ReactTestUtils.renderIntoDocument(<NullPropTypeComponent />);
302 expect(console.error.calls.length).toBe(1);
303 expect(console.error.argsForCall[0][0]).toContain(
304 - 'Invariant Violation: NullPropTypeComponent: prop type `prop` is ' +
305 - 'invalid; it must be a function, usually from React.PropTypes.'
304 + 'NullPropTypeComponent: prop type `prop` is invalid; it must be a ' +
305 + 'function, usually from React.PropTypes.'
306 );
307 });
308
@@ -319,8 +319,8 @@ describe('ReactJSXElementValidator', function() {
319 ReactTestUtils.renderIntoDocument(<NullContextTypeComponent />);
320 expect(console.error.calls.length).toBe(1);
321 expect(console.error.argsForCall[0][0]).toContain(
322 - 'Invariant Violation: NullContextTypeComponent: context type `prop` is ' +
323 - 'invalid; it must be a function, usually from React.PropTypes.'
322 + 'NullContextTypeComponent: context type `prop` is invalid; it must ' +
323 + 'be a function, usually from React.PropTypes.'
324 );
325 });
326
src/renderers/dom/client/__tests__/ReactMount-test.js
+7 -8
@@ -37,8 +37,7 @@ describe('ReactMount', function() {
37 expect(function() {
38 ReactDOM.unmountComponentAtNode(nodeArray);
39 }).toThrow(
40 - 'Invariant Violation: unmountComponentAtNode(...): Target container ' +
41 - 'is not a DOM element.'
40 + 'unmountComponentAtNode(...): Target container is not a DOM element.'
41 );
42 });
43 });
@@ -47,9 +46,9 @@ describe('ReactMount', function() {
46 expect(function() {
47 ReactTestUtils.renderIntoDocument('div');
48 }).toThrow(
50 - 'Invariant Violation: ReactDOM.render(): Invalid component element. ' +
51 - 'Instead of passing an element string, make sure to instantiate it ' +
52 - 'by passing it to React.createElement.'
49 + 'ReactDOM.render(): Invalid component element. Instead of passing an ' +
50 + 'element string, make sure to instantiate it by passing it to ' +
51 + 'React.createElement.'
52 );
53 });
54
@@ -62,9 +61,9 @@ describe('ReactMount', function() {
61 expect(function() {
62 ReactTestUtils.renderIntoDocument(Component);
63 }).toThrow(
65 - 'Invariant Violation: ReactDOM.render(): Invalid component element. ' +
66 - 'Instead of passing a component class, make sure to instantiate it ' +
67 - 'by passing it to React.createElement.'
64 + 'ReactDOM.render(): Invalid component element. Instead of passing a ' +
65 + 'component class, make sure to instantiate it by passing it to ' +
66 + 'React.createElement.'
67 );
68 });
69
src/renderers/dom/client/__tests__/ReactRenderDocument-test.js
+4 -5
@@ -25,7 +25,7 @@ var getTestDocument;
25 var testDocument;
26
27 var UNMOUNT_INVARIANT_MESSAGE =
28 - 'Invariant Violation: <html> tried to unmount. ' +
28 + '<html> tried to unmount. ' +
29 'Because of cross-browser quirks it is impossible to unmount some ' +
30 'top-level components (eg <html>, <head>, and <body>) reliably and ' +
31 'efficiently. To fix this, have a single top-level component that ' +
@@ -215,7 +215,6 @@ describe('rendering React components at document', function() {
215 // Notice the text is different!
216 ReactDOM.render(<Component text="Hello world" />, testDocument);
217 }).toThrow(
218 - 'Invariant Violation: ' +
218 'You\'re trying to render a component to the document using ' +
219 'server rendering but the checksum was invalid. This usually ' +
220 'means you rendered a different component type or props on ' +
@@ -252,9 +251,9 @@ describe('rendering React components at document', function() {
251 expect(function() {
252 ReactDOM.render(<Component />, container);
253 }).toThrow(
255 - 'Invariant Violation: You\'re trying to render a component to the ' +
256 - 'document but you didn\'t use server rendering. We can\'t do this ' +
257 - 'without using server rendering due to cross-browser quirks. See ' +
254 + 'You\'re trying to render a component to the document but you didn\'t ' +
255 + 'use server rendering. We can\'t do this without using server ' +
256 + 'rendering due to cross-browser quirks. See ' +
257 'ReactDOMServer.renderToString() for server rendering.'
258 );
259 });
src/renderers/dom/client/__tests__/findDOMNode-test.js
+4 -5
@@ -37,10 +37,9 @@ describe('findDOMNode', function() {
37 it('findDOMNode should reject random objects', function() {
38 expect(function() {
39 ReactDOM.findDOMNode({foo: 'bar'});
40 - })
41 - .toThrow('Invariant Violation: Element appears to be neither ' +
42 - 'ReactComponent nor DOMNode (keys: foo)'
43 - );
40 + }).toThrow(
41 + 'Element appears to be neither ReactComponent nor DOMNode (keys: foo)'
42 + );
43 });
44
45 it('findDOMNode should reject unmounted objects with render func', function() {
@@ -55,7 +54,7 @@ describe('findDOMNode', function() {
54 ReactDOM.unmountComponentAtNode(container);
55
56 expect(() => ReactDOM.findDOMNode(inst)).toThrow(
58 - 'Invariant Violation: findDOMNode was called on an unmounted component.'
57 + 'findDOMNode was called on an unmounted component.'
58 );
59 });
60
src/renderers/dom/server/__tests__/ReactServerRendering-test.js
+2 -4
@@ -246,8 +246,7 @@ describe('ReactServerRendering', function() {
246 'not a component'
247 )
248 ).toThrow(
249 - 'Invariant Violation: renderToString(): You must pass ' +
250 - 'a valid ReactElement.'
249 + 'renderToString(): You must pass a valid ReactElement.'
250 );
251 });
252 });
@@ -356,8 +355,7 @@ describe('ReactServerRendering', function() {
355 'not a component'
356 )
357 ).toThrow(
359 - 'Invariant Violation: renderToString(): You must pass ' +
360 - 'a valid ReactElement.'
358 + 'renderToString(): You must pass a valid ReactElement.'
359 );
360 });
361
src/renderers/dom/shared/__tests__/Danger-test.js
+1 -1
@@ -79,7 +79,7 @@ describe('Danger', function() {
79 expect(function() {
80 Danger.dangerouslyRenderMarkup(['']);
81 }).toThrow(
82 - 'Invariant Violation: dangerouslyRenderMarkup(...): Missing markup.'
82 + 'dangerouslyRenderMarkup(...): Missing markup.'
83 );
84
85 spyOn(console, 'error');
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+13 -18
@@ -586,8 +586,7 @@ describe('ReactDOMComponent', function() {
586 expect(function() {
587 mountComponent({children: '', dangerouslySetInnerHTML: ''});
588 }).toThrow(
589 - 'Invariant Violation: Can only set one of `children` or ' +
590 - '`props.dangerouslySetInnerHTML`.'
589 + 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
590 );
591 });
592
@@ -605,7 +604,6 @@ describe('ReactDOMComponent', function() {
604 expect(function() {
605 mountComponent({dangerouslySetInnerHTML: '<span>Hi Jim!</span>'});
606 }).toThrow(
608 - 'Invariant Violation: ' +
607 '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
608 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.'
609 );
@@ -615,7 +613,6 @@ describe('ReactDOMComponent', function() {
613 expect(function() {
614 mountComponent({dangerouslySetInnerHTML: {foo: 'bar'} });
615 }).toThrow(
618 - 'Invariant Violation: ' +
616 '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
617 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.'
618 );
@@ -638,9 +635,9 @@ describe('ReactDOMComponent', function() {
635 expect(function() {
636 mountComponent({style: 'display: none'});
637 }).toThrow(
641 - 'Invariant Violation: The `style` prop expects a mapping from style ' +
642 - 'properties to values, not a string. For example, ' +
643 - 'style={{marginRight: spacing + \'em\'}} when using JSX.'
638 + 'The `style` prop expects a mapping from style properties to values, ' +
639 + 'not a string. For example, style={{marginRight: spacing + \'em\'}} ' +
640 + 'when using JSX.'
641 );
642 });
643
@@ -755,8 +752,7 @@ describe('ReactDOMComponent', function() {
752 container
753 );
754 }).toThrow(
758 - 'Invariant Violation: Can only set one of `children` or ' +
759 - '`props.dangerouslySetInnerHTML`.'
755 + 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
756 );
757 });
758
@@ -776,9 +772,9 @@ describe('ReactDOMComponent', function() {
772 expect(function() {
773 ReactDOM.render(<div style={1}></div>, container);
774 }).toThrow(
779 - 'Invariant Violation: The `style` prop expects a mapping from style ' +
780 - 'properties to values, not a string. For example, ' +
781 - 'style={{marginRight: spacing + \'em\'}} when using JSX.'
775 + 'The `style` prop expects a mapping from style properties to values, ' +
776 + 'not a string. For example, style={{marginRight: spacing + \'em\'}} ' +
777 + 'when using JSX.'
778 );
779 });
780
@@ -792,10 +788,9 @@ describe('ReactDOMComponent', function() {
788 expect(function() {
789 ReactDOM.render(<Animal/>, container);
790 }).toThrow(
795 - 'Invariant Violation: The `style` prop expects a mapping from style ' +
796 - 'properties to values, not a string. For example, ' +
797 - 'style={{marginRight: spacing + \'em\'}} when using JSX. ' +
798 - 'This DOM node was rendered by `Animal`.'
791 + 'The `style` prop expects a mapping from style properties to values, ' +
792 + 'not a string. For example, style={{marginRight: spacing + \'em\'}} ' +
793 + 'when using JSX. This DOM node was rendered by `Animal`.'
794 );
795 });
796
@@ -872,7 +867,7 @@ describe('ReactDOMComponent', function() {
867 expect(
868 () => ReactTestUtils.renderIntoDocument(hackzor)
869 ).toThrow(
875 - 'Invariant Violation: Invalid tag: script tag'
870 + 'Invalid tag: script tag'
871 );
872 });
873
@@ -882,7 +877,7 @@ describe('ReactDOMComponent', function() {
877 expect(
878 () => ReactTestUtils.renderIntoDocument(hackzor)
879 ).toThrow(
885 - 'Invariant Violation: Invalid tag: div><img /><div'
880 + 'Invalid tag: div><img /><div'
881 );
882 });
883 });
src/renderers/shared/event/__tests__/EventPluginHub-test.js
+1 -2
@@ -30,8 +30,7 @@ describe('EventPluginHub', function() {
30 expect(function() {
31 EventPluginHub.putListener(1, 'onClick', 'not a function');
32 }).toThrow(
33 - 'Invariant Violation: Expected onClick listener to be a function, ' +
34 - 'instead got type string'
33 + 'Expected onClick listener to be a function, instead got type string'
34 );
35 });
36 });
src/renderers/shared/event/__tests__/EventPluginRegistry-test.js
+12 -13
@@ -97,8 +97,8 @@ describe('EventPluginRegistry', function() {
97 bad: BadPlugin,
98 });
99 }).toThrow(
100 - 'Invariant Violation: EventPluginRegistry: Event plugins must ' +
101 - 'implement an `extractEvents` method, but `bad` does not.'
100 + 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
101 + 'method, but `bad` does not.'
102 );
103 });
104
@@ -114,8 +114,8 @@ describe('EventPluginRegistry', function() {
114 random: RandomPlugin,
115 });
116 }).toThrow(
117 - 'Invariant Violation: EventPluginRegistry: Cannot inject event plugins ' +
118 - 'that do not exist in the plugin ordering, `random`.'
117 + 'EventPluginRegistry: Cannot inject event plugins that do not exist ' +
118 + 'in the plugin ordering, `random`.'
119 );
120 });
121
@@ -127,9 +127,8 @@ describe('EventPluginRegistry', function() {
127 expect(function() {
128 EventPluginRegistry.injectEventPluginOrder(pluginOrdering);
129 }).toThrow(
130 - 'Invariant Violation: EventPluginRegistry: Cannot inject event plugin ' +
131 - 'ordering more than once. You are likely trying to load more than one ' +
132 - 'copy of React.'
130 + 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
131 + 'once. You are likely trying to load more than one copy of React.'
132 );
133 });
134
@@ -142,8 +141,8 @@ describe('EventPluginRegistry', function() {
141 expect(function() {
142 EventPluginRegistry.injectEventPluginsByName({same: TwoPlugin});
143 }).toThrow(
145 - 'Invariant Violation: EventPluginRegistry: Cannot inject two different ' +
146 - 'event plugins using the same name, `same`.'
144 + 'EventPluginRegistry: Cannot inject two different event plugins using ' +
145 + 'the same name, `same`.'
146 );
147 });
148
@@ -206,8 +205,8 @@ describe('EventPluginRegistry', function() {
205 expect(function() {
206 EventPluginRegistry.injectEventPluginOrder(['one', 'two']);
207 }).toThrow(
209 - 'Invariant Violation: EventPluginHub: More than one plugin attempted ' +
210 - 'to publish the same registration name, `onPhotoCapture`.'
208 + 'EventPluginHub: More than one plugin attempted to publish the same ' +
209 + 'registration name, `onPhotoCapture`.'
210 );
211 });
212
@@ -223,8 +222,8 @@ describe('EventPluginRegistry', function() {
222 expect(function() {
223 EventPluginRegistry.injectEventPluginOrder(['one']);
224 }).toThrow(
226 - 'Invariant Violation: EventPluginRegistry: Failed to publish event ' +
227 - '`badEvent` for plugin `one`.'
225 + 'EventPluginRegistry: Failed to publish event `badEvent` for plugin ' +
226 + '`one`.'
227 );
228 });
229
src/renderers/shared/reconciler/__tests__/ReactComponent-test.js
+8 -13
@@ -31,15 +31,13 @@ describe('ReactComponent', function() {
31 expect(function() {
32 ReactDOM.render(<div></div>, [container]);
33 }).toThrow(
34 - 'Invariant Violation: _registerComponent(...): Target container ' +
35 - 'is not a DOM element.'
34 + '_registerComponent(...): Target container is not a DOM element.'
35 );
36
37 expect(function() {
38 ReactDOM.render(<div></div>, null);
39 }).toThrow(
41 - 'Invariant Violation: _registerComponent(...): Target container ' +
42 - 'is not a DOM element.'
40 + '_registerComponent(...): Target container is not a DOM element.'
41 );
42 });
43
@@ -295,23 +293,20 @@ describe('ReactComponent', function() {
293
294 var X = undefined;
295 expect(() => ReactTestUtils.renderIntoDocument(<X />)).toThrow(
298 - 'Invariant Violation: Element type is invalid: expected a string (for ' +
299 - 'built-in components) or a class/function (for composite components) ' +
300 - 'but got: undefined.'
296 + 'Element type is invalid: expected a string (for built-in components) ' +
297 + 'or a class/function (for composite components) but got: undefined.'
298 );
299
300 var Y = null;
301 expect(() => ReactTestUtils.renderIntoDocument(<Y />)).toThrow(
305 - 'Invariant Violation: Element type is invalid: expected a string (for ' +
306 - 'built-in components) or a class/function (for composite components) ' +
307 - 'but got: null.'
302 + 'Element type is invalid: expected a string (for built-in components) ' +
303 + 'or a class/function (for composite components) but got: null.'
304 );
305
306 var Z = {};
307 expect(() => ReactTestUtils.renderIntoDocument(<Z />)).toThrow(
312 - 'Invariant Violation: Element type is invalid: expected a string (for ' +
313 - 'built-in components) or a class/function (for composite components) ' +
314 - 'but got: object.'
308 + 'Element type is invalid: expected a string (for built-in components) ' +
309 + 'or a class/function (for composite components) but got: object.'
310 );
311
312 // One warning for each element creation
src/renderers/shared/reconciler/__tests__/ReactComponentLifeCycle-test.js
+4 -5
@@ -477,11 +477,10 @@ describe('ReactComponentLifeCycle', function() {
477 expect(function() {
478 instance = ReactTestUtils.renderIntoDocument(instance);
479 }).toThrow(
480 - 'Invariant Violation: setProps(...): You called `setProps` on a ' +
481 - 'component with a parent. This is an anti-pattern since props will get ' +
482 - 'reactively updated when rendered. Instead, change the owner\'s ' +
483 - '`render` method to pass the correct value as props to the component ' +
484 - 'where it is created.'
480 + 'setProps(...): You called `setProps` on a component with a parent. ' +
481 + 'This is an anti-pattern since props will get reactively updated ' +
482 + 'when rendered. Instead, change the owner\'s `render` method to pass ' +
483 + 'the correct value as props to the component where it is created.'
484 );
485 expect(console.error.calls.length).toBe(1); // setProps deprecated
486 });
src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+4 -5
@@ -459,11 +459,10 @@ describe('ReactCompositeComponent', function() {
459 expect(function() {
460 innerInstance.setProps({value: 1});
461 }).toThrow(
462 - 'Invariant Violation: setProps(...): You called `setProps` on a ' +
463 - 'component with a parent. This is an anti-pattern since props will get ' +
464 - 'reactively updated when rendered. Instead, change the owner\'s ' +
465 - '`render` method to pass the correct value as props to the component ' +
466 - 'where it is created.'
462 + 'setProps(...): You called `setProps` on a component with a parent. ' +
463 + 'This is an anti-pattern since props will get reactively updated when ' +
464 + 'rendered. Instead, change the owner\'s `render` method to pass the ' +
465 + 'correct value as props to the component where it is created.'
466 );
467 });
468
src/renderers/shared/reconciler/__tests__/ReactEmptyComponent-test.js
+3 -4
@@ -75,9 +75,8 @@ describe('ReactEmptyComponent', function() {
75 expect(function() {
76 ReactTestUtils.renderIntoDocument(<Component />);
77 }).toThrow(
78 - 'Invariant Violation: Component.render(): A valid ReactComponent must ' +
79 - 'be returned. You may have returned undefined, an array or some other ' +
80 - 'invalid object.'
78 + 'Component.render(): A valid ReactComponent must be returned. You may ' +
79 + 'have returned undefined, an array or some other invalid object.'
80 );
81 });
82
@@ -226,7 +225,7 @@ describe('ReactEmptyComponent', function() {
225 expect(function() {
226 ReactDOM.render(null, div);
227 }).toThrow(
229 - 'Invariant Violation: ReactDOM.render(): Invalid component element.'
228 + 'ReactDOM.render(): Invalid component element.'
229 );
230 });
231
src/renderers/shared/reconciler/__tests__/ReactInstanceHandles-test.js
+6 -7
@@ -142,13 +142,12 @@ describe('ReactInstanceHandles', function() {
142 junkID
143 );
144 }).toThrow(
145 - 'Invariant Violation: findComponentRoot(..., ' + junkID + '): ' +
146 - 'Unable to find element. This probably means the DOM was ' +
147 - 'unexpectedly mutated (e.g., by the browser), usually due to ' +
148 - 'forgetting a <tbody> when using tables, nesting tags ' +
149 - 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
150 - 'parent. ' +
151 - 'Try inspecting the child nodes of the element with React ID ``.'
145 + 'findComponentRoot(..., ' + junkID + '): Unable to find element. ' +
146 + 'This probably means the DOM was unexpectedly mutated (e.g., by the ' +
147 + 'browser), usually due to forgetting a <tbody> when using tables, ' +
148 + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements in ' +
149 + 'an <svg> parent. Try inspecting the child nodes of the element with ' +
150 + 'React ID ``.'
151 );
152
153 expect(console.error.argsForCall.length).toBe(1);
src/renderers/shared/reconciler/__tests__/ReactStatelessComponent-test.js
+1 -1
@@ -121,7 +121,7 @@ describe('ReactStatelessComponent', function() {
121 expect(function() {
122 ReactTestUtils.renderIntoDocument(<Child test="test" />);
123 }).toThrow(
124 - 'Invariant Violation: Stateless function components cannot have refs.'
124 + 'Stateless function components cannot have refs.'
125 );
126 });
127
src/shared/utils/__tests__/OrderedMap-test.js
+2 -4
@@ -733,14 +733,12 @@ describe('OrderedMap', function() {
733 expect(function() {
734 om.mapKeyRange(duplicate, 'x', 3, scope);
735 }).toThrow(
736 - 'Invariant Violation: mapKeyRange must be given keys ' +
737 - 'that are present.'
736 + 'mapKeyRange must be given keys that are present.'
737 );
738 expect(function() {
739 om.forEachKeyRange(duplicate, 'x', 3, scope);
740 }).toThrow(
742 - 'Invariant Violation: forEachKeyRange must be given keys ' +
743 - 'that are present.'
741 + 'forEachKeyRange must be given keys that are present.'
742 );
743
744 expect(function() {
src/shared/utils/__tests__/PooledClass-test.js
+1 -2
@@ -111,8 +111,7 @@ describe('Pooled class', function() {
111 expect(function() {
112 PoolableClass.release(randomInstance);
113 }).toThrow(
114 - 'Invariant Violation: Trying to release an instance into a pool ' +
115 - 'of a different type.'
114 + 'Trying to release an instance into a pool of a different type.'
115 );
116 }
117 );
src/shared/utils/__tests__/accumulateInto-test.js
+1 -2
@@ -26,8 +26,7 @@ describe('accumulateInto', function() {
26 expect(function() {
27 accumulateInto([], null);
28 }).toThrow(
29 - 'Invariant Violation: accumulateInto(...): Accumulated items must not ' +
30 - 'be null or undefined.'
29 + 'accumulateInto(...): Accumulated items must not be null or undefined.'
30 );
31 });
32
src/shared/utils/__tests__/traverseAllChildren-test.js
+7 -8
@@ -480,10 +480,10 @@ describe('traverseAllChildren', function() {
480 expect(function() {
481 traverseAllChildren({a: 1, b: 2}, function() {}, null);
482 }).toThrow(
483 - 'Invariant Violation: Objects are not valid as a React child (found: ' +
484 - 'object with keys {a, b}). If you meant to render a collection of ' +
485 - 'children, use an array instead or wrap the object using ' +
486 - 'createFragment(object) from the React add-ons.'
483 + 'Objects are not valid as a React child (found: object with keys ' +
484 + '{a, b}). If you meant to render a collection of children, use an ' +
485 + 'array instead or wrap the object using createFragment(object) from ' +
486 + 'the React add-ons.'
487 );
488 });
489
@@ -493,10 +493,9 @@ describe('traverseAllChildren', function() {
493 expect(function() {
494 traverseAllChildren(/abc/, function() {}, null);
495 }).toThrow(
496 - 'Invariant Violation: Objects are not valid as a React child (found: ' +
497 - '/abc/). If you meant to render a collection of children, use an array ' +
498 - 'instead or wrap the object using createFragment(object) from the ' +
499 - 'React add-ons.'
496 + 'Objects are not valid as a React child (found: /abc/). If you meant ' +
497 + 'to render a collection of children, use an array instead or wrap the ' +
498 + 'object using createFragment(object) from the React add-ons.'
499 );
500 });
501
src/test/__tests__/ReactTestUtils-test.js
+7 -7
@@ -62,15 +62,15 @@ describe('ReactTestUtils', function() {
62
63 var shallowRenderer = ReactTestUtils.createRenderer();
64 expect(() => shallowRenderer.render(SomeComponent)).toThrow(
65 - 'Invariant Violation: ReactShallowRenderer render(): Invalid component ' +
66 - 'element. Instead of passing a component class, make sure to ' +
67 - 'instantiate it by passing it to React.createElement.'
65 + 'ReactShallowRenderer render(): Invalid component element. Instead of ' +
66 + 'passing a component class, make sure to instantiate it by passing it ' +
67 + 'to React.createElement.'
68 );
69 expect(() => shallowRenderer.render(<div />)).toThrow(
70 - 'Invariant Violation: ReactShallowRenderer render(): Shallow rendering ' +
71 - 'works only with custom components, not primitives (div). Instead of ' +
72 - 'calling `.render(el)` and inspecting the rendered output, look at ' +
73 - '`el.props` directly instead.'
70 + 'ReactShallowRenderer render(): Shallow rendering works only with ' +
71 + 'custom components, not primitives (div). Instead of calling ' +
72 + '`.render(el)` and inspecting the rendered output, look at `el.props` ' +
73 + 'directly instead.'
74 );
75 });
76