babel-plugin-jest-hoist
Advanced tools
Comparing version 19.0.0 to 19.1.0-alpha.eed82034
@@ -115,5 +115,8 @@ /** | ||
'reference any out-of-scope variables.\n' + | ||
'Invalid variable access: ' + name + '\n' + | ||
'Invalid variable access: ' + | ||
name + | ||
'\n' + | ||
'Whitelisted objects: ' + | ||
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.\n' + | ||
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + | ||
'.\n' + | ||
'Note: This is a precaution to guard against uninitialized mock ' + | ||
@@ -134,5 +137,4 @@ 'variables. If it is ensured that the mock is required lazily, ' + | ||
FUNCTIONS.disableAutomock = | ||
FUNCTIONS.enableAutomock = | ||
args => args.length === 0; | ||
FUNCTIONS.disableAutomock = FUNCTIONS.enableAutomock = args => | ||
args.length === 0; | ||
@@ -143,3 +145,2 @@ module.exports = babel => { | ||
callee.isMemberExpression() && isJest(callee.get('object')); | ||
const shouldHoistExpression = expr => { | ||
@@ -153,11 +154,7 @@ if (!expr.isCallExpression()) { | ||
const property = callee.get('property'); | ||
return ( | ||
property.isIdentifier() && | ||
FUNCTIONS[property.node.name] && ( | ||
object.isIdentifier(JEST_GLOBAL) || | ||
callee.isMemberExpression() && shouldHoistExpression(object)) && | ||
FUNCTIONS[property.node.name](expr.get('arguments'))); | ||
return property.isIdentifier() && | ||
FUNCTIONS[property.node.name] && ( | ||
object.isIdentifier(JEST_GLOBAL) || | ||
callee.isMemberExpression() && shouldHoistExpression(object)) && | ||
FUNCTIONS[property.node.name](expr.get('arguments')); | ||
}; | ||
@@ -164,0 +161,0 @@ return { |
{ | ||
"name": "babel-plugin-jest-hoist", | ||
"version": "19.0.0", | ||
"version": "19.1.0-alpha.eed82034", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
5277
145
2