@samitouri / QOS-React / commits / af4fe68b14

Change message format to be more consistent with other errors

Dan Abramov committed Mar 21, 2016 at 23:13 UTC af4fe68b145e4a11c868e8bd81494138b38b27e4
3 files changed +32 -32
src/renderers/dom/client/__tests__/ReactDOM-test.js
+12 -12
@@ -134,16 +134,16 @@ describe('ReactDOM', function() {
134
135 var myDiv = document.createElement('div');
136 expect(() => ReactDOM.render(<A />, myDiv, 'no')).toThrow(
137 - 'You called `ReactDOM.render` with the last argument of type string. ' +
138 - 'When specified, its last `callback` argument must be a function.'
137 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
138 + 'to be a function. Instead received: string.'
139 );
140 expect(() => ReactDOM.render(<A />, myDiv, {})).toThrow(
141 - 'You called `ReactDOM.render` with the last argument of type Object. ' +
142 - 'When specified, its last `callback` argument must be a function.'
141 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
142 + 'to be a function. Instead received: Object.'
143 );
144 expect(() => ReactDOM.render(<A />, myDiv, new Foo())).toThrow(
145 - 'You called `ReactDOM.render` with the last argument of type Foo (keys: a, b). ' +
146 - 'When specified, its last `callback` argument must be a function.'
145 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
146 + 'to be a function. Instead received: Foo (keys: a, b).'
147 );
148 });
149
@@ -165,16 +165,16 @@ describe('ReactDOM', function() {
165 ReactDOM.render(<A />, myDiv);
166
167 expect(() => ReactDOM.render(<A />, myDiv, 'no')).toThrow(
168 - 'You called `ReactDOM.render` with the last argument of type string. ' +
169 - 'When specified, its last `callback` argument must be a function.'
168 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
169 + 'to be a function. Instead received: string.'
170 );
171 expect(() => ReactDOM.render(<A />, myDiv, {})).toThrow(
172 - 'You called `ReactDOM.render` with the last argument of type Object. ' +
173 - 'When specified, its last `callback` argument must be a function.'
172 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
173 + 'to be a function. Instead received: Object.'
174 );
175 expect(() => ReactDOM.render(<A />, myDiv, new Foo())).toThrow(
176 - 'You called `ReactDOM.render` with the last argument of type Foo (keys: a, b). ' +
177 - 'When specified, its last `callback` argument must be a function.'
176 + 'ReactDOM.render(...): Expected the last optional `callback` argument ' +
177 + 'to be a function. Instead received: Foo (keys: a, b).'
178 );
179 });
180 });
src/renderers/shared/reconciler/ReactUpdateQueue.js
+2 -2
@@ -244,8 +244,8 @@ var ReactUpdateQueue = {
244 validateCallback: function(callback, callerName) {
245 invariant(
246 !callback || typeof callback === 'function',
247 - 'You called `%s` with the last argument of type %s. ' +
248 - 'When specified, its last `callback` argument must be a function.',
247 + '%s(...): Expected the last optional `callback` argument to be a ' +
248 + 'function. Instead received: %s.',
249 callerName,
250 formatUnexpectedArgument(callback)
251 );
src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
+18 -18
@@ -954,16 +954,16 @@ describe('ReactUpdates', function() {
954 var component = ReactTestUtils.renderIntoDocument(<A />);
955
956 expect(() => component.setState({}, 'no')).toThrow(
957 - 'You called `setState` with the last argument of type string. ' +
958 - 'When specified, its last `callback` argument must be a function.'
957 + 'setState(...): Expected the last optional `callback` argument ' +
958 + 'to be a function. Instead received: string.'
959 );
960 expect(() => component.setState({}, {})).toThrow(
961 - 'You called `setState` with the last argument of type Object. ' +
962 - 'When specified, its last `callback` argument must be a function.'
961 + 'setState(...): Expected the last optional `callback` argument ' +
962 + 'to be a function. Instead received: Object.'
963 );
964 expect(() => component.setState({}, new Foo())).toThrow(
965 - 'You called `setState` with the last argument of type Foo (keys: a, b). ' +
966 - 'When specified, its last `callback` argument must be a function.'
965 + 'setState(...): Expected the last optional `callback` argument ' +
966 + 'to be a function. Instead received: Foo (keys: a, b).'
967 );
968 });
969
@@ -983,16 +983,16 @@ describe('ReactUpdates', function() {
983 var component = ReactTestUtils.renderIntoDocument(<A />);
984
985 expect(() => component.replaceState({}, 'no')).toThrow(
986 - 'You called `replaceState` with the last argument of type string. ' +
987 - 'When specified, its last `callback` argument must be a function.'
986 + 'replaceState(...): Expected the last optional `callback` argument ' +
987 + 'to be a function. Instead received: string.'
988 );
989 expect(() => component.replaceState({}, {})).toThrow(
990 - 'You called `replaceState` with the last argument of type Object. ' +
991 - 'When specified, its last `callback` argument must be a function.'
990 + 'replaceState(...): Expected the last optional `callback` argument ' +
991 + 'to be a function. Instead received: Object.'
992 );
993 expect(() => component.replaceState({}, new Foo())).toThrow(
994 - 'You called `replaceState` with the last argument of type Foo (keys: a, b). ' +
995 - 'When specified, its last `callback` argument must be a function.'
994 + 'replaceState(...): Expected the last optional `callback` argument ' +
995 + 'to be a function. Instead received: Foo (keys: a, b).'
996 );
997 });
998
@@ -1012,16 +1012,16 @@ describe('ReactUpdates', function() {
1012 var component = ReactTestUtils.renderIntoDocument(<A />);
1013
1014 expect(() => component.forceUpdate('no')).toThrow(
1015 - 'You called `forceUpdate` with the last argument of type string. ' +
1016 - 'When specified, its last `callback` argument must be a function.'
1015 + 'forceUpdate(...): Expected the last optional `callback` argument ' +
1016 + 'to be a function. Instead received: string.'
1017 );
1018 expect(() => component.forceUpdate({})).toThrow(
1019 - 'You called `forceUpdate` with the last argument of type Object. ' +
1020 - 'When specified, its last `callback` argument must be a function.'
1019 + 'forceUpdate(...): Expected the last optional `callback` argument ' +
1020 + 'to be a function. Instead received: Object.'
1021 );
1022 expect(() => component.forceUpdate(new Foo())).toThrow(
1023 - 'You called `forceUpdate` with the last argument of type Foo (keys: a, b). ' +
1024 - 'When specified, its last `callback` argument must be a function.'
1023 + 'forceUpdate(...): Expected the last optional `callback` argument ' +
1024 + 'to be a function. Instead received: Foo (keys: a, b).'
1025 );
1026 });
1027 });