react-test-renderer
Advanced tools
Comparing version 16.0.0-beta.2 to 16.0.0-beta.3
@@ -5,2 +5,3 @@ 'use strict'; | ||
if (process.env.NODE_ENV !== "production") { | ||
(function() { | ||
@@ -39,3 +40,3 @@ 'use strict'; | ||
var describeComponentFrame$1 = function (name, source, ownerName) { | ||
var describeComponentFrame = function (name, source, ownerName) { | ||
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); | ||
@@ -56,3 +57,3 @@ }; | ||
function getComponentName$1(instanceOrFiber) { | ||
function getComponentName(instanceOrFiber) { | ||
if (typeof instanceOrFiber.getName === 'function') { | ||
@@ -78,3 +79,3 @@ // Stack reconciler | ||
var getComponentName_1 = getComponentName$1; | ||
var getComponentName_1 = getComponentName; | ||
@@ -93,31 +94,5 @@ var _extends = objectAssign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
{ | ||
var describeComponentFrame = describeComponentFrame$1; | ||
var getComponentName = getComponentName_1; | ||
var currentlyValidatingElement = null; | ||
var getDisplayName = function (element) { | ||
if (element == null) { | ||
return '#empty'; | ||
} else if (typeof element === 'string' || typeof element === 'number') { | ||
return '#text'; | ||
} else if (typeof element.type === 'string') { | ||
return element.type; | ||
} else { | ||
return element.type.displayName || element.type.name || 'Unknown'; | ||
} | ||
}; | ||
var getStackAddendum = function () { | ||
var stack = ''; | ||
if (currentlyValidatingElement) { | ||
var name = getDisplayName(currentlyValidatingElement); | ||
var owner = currentlyValidatingElement._owner; | ||
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner)); | ||
} | ||
return stack; | ||
}; | ||
} | ||
var ReactShallowRenderer = function () { | ||
@@ -215,8 +190,4 @@ function ReactShallowRenderer() { | ||
this._rendered = this._instance.render(); | ||
// Calling cDU might lead to problems with host component references. | ||
// Since our components aren't really mounted, refs won't be available. | ||
// if (typeof this._instance.componentDidMount === 'function') { | ||
// this._instance.componentDidMount(); | ||
// } | ||
// Intentionally do not call componentDidMount() | ||
// because DOM refs are not available. | ||
}; | ||
@@ -226,6 +197,5 @@ | ||
var oldProps = this._instance.props; | ||
var oldState = this._instance.state; | ||
if (oldProps !== props && typeof this._instance.componentWillReceiveProps === 'function') { | ||
this._instance.componentWillReceiveProps(props); | ||
this._instance.componentWillReceiveProps(props, context); | ||
} | ||
@@ -256,7 +226,4 @@ | ||
this._rendered = this._instance.render(); | ||
// The 15.x shallow renderer triggered cDU for setState() calls only. | ||
if (oldState !== state && typeof this._instance.componentDidUpdate === 'function') { | ||
this._instance.componentDidUpdate(oldProps, oldState); | ||
} | ||
// Intentionally do not call componentDidUpdate() | ||
// because DOM refs are not available. | ||
}; | ||
@@ -316,2 +283,26 @@ | ||
var currentlyValidatingElement = null; | ||
function getDisplayName(element) { | ||
if (element == null) { | ||
return '#empty'; | ||
} else if (typeof element === 'string' || typeof element === 'number') { | ||
return '#text'; | ||
} else if (typeof element.type === 'string') { | ||
return element.type; | ||
} else { | ||
return element.type.displayName || element.type.name || 'Unknown'; | ||
} | ||
} | ||
function getStackAddendum() { | ||
var stack = ''; | ||
if (currentlyValidatingElement) { | ||
var name = getDisplayName(currentlyValidatingElement); | ||
var owner = currentlyValidatingElement._owner; | ||
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName_1(owner)); | ||
} | ||
return stack; | ||
} | ||
function getName(type, instance) { | ||
@@ -330,2 +321,3 @@ var constructor = instance && instance.constructor; | ||
})(); | ||
} |
{ | ||
"name": "react-test-renderer", | ||
"version": "16.0.0-beta.2", | ||
"version": "16.0.0-beta.3", | ||
"description": "React package for snapshot testing.", | ||
@@ -22,3 +22,3 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"react": "^16.0.0-beta.2" | ||
"react": "^16.0.0-beta.3" | ||
}, | ||
@@ -25,0 +25,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
307401
7306