react-test-renderer 16.5.2 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-test-renderer",
3
- "version": "16.5.2",
3
+ "version": "16.6.0",
4
4
  "description": "React package for snapshot testing.",
5
5
  "main": "index.js",
6
6
  "repository": "facebook/react",
@@ -17,8 +17,8 @@
17
17
  "dependencies": {
18
18
  "object-assign": "^4.1.1",
19
19
  "prop-types": "^15.6.2",
20
- "react-is": "^16.5.2",
21
- "schedule": "^0.5.0"
20
+ "react-is": "^16.6.0",
21
+ "scheduler": "^0.10.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^16.0.0"
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.2
1
+ /** @license React v16.6.0
2
2
  * react-test-renderer-shallow.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -75,9 +75,29 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
75
75
  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
76
76
  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
77
77
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
78
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
78
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
79
79
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
80
- var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
80
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
81
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
82
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
83
+
84
+ /**
85
+ * Forked from fbjs/warning:
86
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
87
+ *
88
+ * Only change is we use console.warn instead of console.error,
89
+ * and do nothing when 'console' is not supported.
90
+ * This really simplifies the code.
91
+ * ---
92
+ * Similar to invariant but only logs a warning if the condition is not met.
93
+ * This can be used to log issues in development environments in critical
94
+ * paths. Removing the logging code for production environments will keep the
95
+ * same logic and follow the same code paths.
96
+ */
97
+
98
+ {
99
+
100
+ }
81
101
 
82
102
  function typeOf(object) {
83
103
  if (typeof object === 'object' && object !== null) {
@@ -88,7 +108,7 @@ function typeOf(object) {
88
108
  var type = object.type;
89
109
 
90
110
  switch (type) {
91
- case REACT_ASYNC_MODE_TYPE:
111
+ case REACT_CONCURRENT_MODE_TYPE:
92
112
  case REACT_FRAGMENT_TYPE:
93
113
  case REACT_PROFILER_TYPE:
94
114
  case REACT_STRICT_MODE_TYPE:
@@ -113,6 +133,9 @@ function typeOf(object) {
113
133
  return undefined;
114
134
  }
115
135
 
136
+ // AsyncMode alias is deprecated along with isAsyncMode
137
+
138
+
116
139
 
117
140
 
118
141
 
@@ -122,6 +145,7 @@ function typeOf(object) {
122
145
 
123
146
 
124
147
 
148
+ // AsyncMode should be deprecated
125
149
 
126
150
 
127
151
 
@@ -251,10 +275,13 @@ var warningWithoutStack$1 = warningWithoutStack;
251
275
  var Resolved = 1;
252
276
 
253
277
 
278
+ function refineResolvedLazyComponent(lazyComponent) {
279
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
280
+ }
254
281
 
255
-
256
- function refineResolvedThenable(thenable) {
257
- return thenable._reactStatus === Resolved ? thenable._reactResult : null;
282
+ function getWrappedName(outerType, innerType, wrapperName) {
283
+ var functionName = innerType.displayName || innerType.name || '';
284
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
258
285
  }
259
286
 
260
287
  function getComponentName(type) {
@@ -274,8 +301,8 @@ function getComponentName(type) {
274
301
  return type;
275
302
  }
276
303
  switch (type) {
277
- case REACT_ASYNC_MODE_TYPE:
278
- return 'AsyncMode';
304
+ case REACT_CONCURRENT_MODE_TYPE:
305
+ return 'ConcurrentMode';
279
306
  case REACT_FRAGMENT_TYPE:
280
307
  return 'Fragment';
281
308
  case REACT_PORTAL_TYPE:
@@ -284,8 +311,8 @@ function getComponentName(type) {
284
311
  return 'Profiler';
285
312
  case REACT_STRICT_MODE_TYPE:
286
313
  return 'StrictMode';
287
- case REACT_PLACEHOLDER_TYPE:
288
- return 'Placeholder';
314
+ case REACT_SUSPENSE_TYPE:
315
+ return 'Suspense';
289
316
  }
290
317
  if (typeof type === 'object') {
291
318
  switch (type.$$typeof) {
@@ -294,16 +321,17 @@ function getComponentName(type) {
294
321
  case REACT_PROVIDER_TYPE:
295
322
  return 'Context.Provider';
296
323
  case REACT_FORWARD_REF_TYPE:
297
- var renderFn = type.render;
298
- var functionName = renderFn.displayName || renderFn.name || '';
299
- return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
300
- }
301
- if (typeof type.then === 'function') {
302
- var thenable = type;
303
- var resolvedThenable = refineResolvedThenable(thenable);
304
- if (resolvedThenable) {
305
- return getComponentName(resolvedThenable);
306
- }
324
+ return getWrappedName(type, type.render, 'ForwardRef');
325
+ case REACT_MEMO_TYPE:
326
+ return getComponentName(type.type);
327
+ case REACT_LAZY_TYPE:
328
+ {
329
+ var thenable = type;
330
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
331
+ if (resolvedThenable) {
332
+ return getComponentName(resolvedThenable);
333
+ }
334
+ }
307
335
  }
308
336
  }
309
337
  return null;
@@ -383,13 +411,13 @@ var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
383
411
 
384
412
 
385
413
 
386
- var printWarning = function() {};
414
+ var printWarning$1 = function() {};
387
415
 
388
416
  {
389
417
  var ReactPropTypesSecret = ReactPropTypesSecret_1;
390
418
  var loggedTypeFailures = {};
391
419
 
392
- printWarning = function(text) {
420
+ printWarning$1 = function(text) {
393
421
  var message = 'Warning: ' + text;
394
422
  if (typeof console !== 'undefined') {
395
423
  console.error(message);
@@ -438,7 +466,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
438
466
  error = ex;
439
467
  }
440
468
  if (error && !(error instanceof Error)) {
441
- printWarning(
469
+ printWarning$1(
442
470
  (componentName || 'React class') + ': type specification of ' +
443
471
  location + ' `' + typeSpecName + '` is invalid; the type checker ' +
444
472
  'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
@@ -455,7 +483,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
455
483
 
456
484
  var stack = getStack ? getStack() : '';
457
485
 
458
- printWarning(
486
+ printWarning$1(
459
487
  'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
460
488
  );
461
489
  }
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.2
1
+ /** @license React v16.6.0
2
2
  * react-test-renderer-shallow.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -9,14 +9,14 @@
9
9
  'use strict';(function(g,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("react")):"function"===typeof define&&define.amd?define(["react"],e):g.ReactShallowRenderer=e(g.React)})(this,function(g){function e(a,b,f,d,c,h,g,x){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[f,d,c,h,g,x],e=0;a=Error(b.replace(/%s/g,function(){return w[e++]}));
10
10
  a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function n(a){for(var b=arguments.length-1,f="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)f+="&args[]="+encodeURIComponent(arguments[d+1]);e(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",f)}function q(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case y:switch(a=a.type,a){case z:case A:case B:case C:return a;
11
11
  default:switch(a=a&&a.$$typeof,a){case D:case p:case E:return a;default:return b}}case F:return b}}}function r(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function t(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var f=Object.keys(a),d=Object.keys(b);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++)if(!G.call(b,f[d])||!r(a[f[d]],b[f[d]]))return!1;return!0}function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
12
- }var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,F=c?Symbol.for("react.portal"):60106,A=c?Symbol.for("react.fragment"):60107,C=c?Symbol.for("react.strict_mode"):60108,B=c?Symbol.for("react.profiler"):60114,E=c?Symbol.for("react.provider"):60109,D=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.async_mode"):60111,p=c?Symbol.for("react.forward_ref"):60112;c&&Symbol.for("react.placeholder");var G=
13
- Object.prototype.hasOwnProperty,l={},H=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,d){this._enqueueCallback(a,
14
- b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&(this._renderer._newState=v({},d,a),this._renderer.render(this._renderer._element,
15
- this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new H(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:l;g.isValidElement(b)?void 0:n("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
16
- "");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c={},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?this._updateClassComponent(b,this._context):q(b)===p?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props,
17
- this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=
18
- null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),
19
- "function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,c){var b=a.props,f=a.type,h=this._instance.state||l,g=this._instance.props;g!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&
20
- this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(b,e,c):f.prototype&&f.prototype.isPureReactComponent&&(k=!t(g,b)||!t(h,e));k&&"function"!==typeof a.type.getDerivedStateFromProps&&
21
- "function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=c;this._instance.props=b;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=
22
- this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};c=(c={default:m},m)||c;return c.default||c});
12
+ }var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,F=c?Symbol.for("react.portal"):60106,A=c?Symbol.for("react.fragment"):60107,C=c?Symbol.for("react.strict_mode"):60108,B=c?Symbol.for("react.profiler"):60114,E=c?Symbol.for("react.provider"):60109,D=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.concurrent_mode"):60111,p=c?Symbol.for("react.forward_ref"):60112;c&&Symbol.for("react.suspense");c&&
13
+ Symbol.for("react.memo");c&&Symbol.for("react.lazy");var G=Object.prototype.hasOwnProperty,l={},H=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=
14
+ function(b,a,d){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&
15
+ (this._renderer._newState=v({},d,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new H(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?
16
+ arguments[1]:l;g.isValidElement(b)?void 0:n("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c={},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?
17
+ this._updateClassComponent(b,this._context):q(b)===p?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=
18
+ function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};a.prototype._mountClassComponent=function(b,a){this._instance.context=a;this._instance.props=b.props;this._instance.state=this._instance.state||null;this._instance.updater=this._updater;if("function"===typeof this._instance.UNSAFE_componentWillMount||"function"===typeof this._instance.componentWillMount)a=
19
+ this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,c){var b=a.props,f=a.type,h=this._instance.state||
20
+ l,g=this._instance.props;g!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===
21
+ typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(b,e,c):f.prototype&&f.prototype.isPureReactComponent&&(k=!t(g,b)||!t(h,e));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=
22
+ c;this._instance.props=b;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};c=(c={default:m},m)||c;return c.default||c});