babel-plugin-jest-hoist
Advanced tools
Comparing version 13.2.2 to 13.3.0-alpha.4eb0c908
@@ -17,6 +17,8 @@ /** | ||
// We allow `jest`, `require`, all default Node.js globals and all ES2015 | ||
// built-ins to be used inside of a `jest.mock` factory. | ||
// We allow `jest`, `expect`, `require`, all default Node.js globals and all | ||
// ES2015 built-ins to be used inside of a `jest.mock` factory. | ||
// We also allow variables prefixed with `mock` as an escape-hatch. | ||
const WHITELISTED_IDENTIFIERS = { | ||
jest: true, | ||
expect: true, | ||
require: true, | ||
@@ -107,8 +109,12 @@ Infinity: true, | ||
invariant( | ||
scope.hasGlobal(name) && WHITELISTED_IDENTIFIERS[name], | ||
'The second argument of `jest.mock()` is not allowed to ' + | ||
'reference any outside variables.\n' + | ||
scope.hasGlobal(name) && WHITELISTED_IDENTIFIERS[name] || | ||
/^mock/.test(name), | ||
'The module factory of `jest.mock()` is not allowed to ' + | ||
'reference any out-of-scope variables.\n' + | ||
'Invalid variable access: ' + name + '\n' + | ||
'Whitelisted objects: ' + | ||
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.');}} | ||
Object.keys(WHITELISTED_IDENTIFIERS).join(', ') + '.\n' + | ||
'Note: This is a precaution to guard against uninitialized mock ' + | ||
'variables. If it is ensured that the mock is required lazily, ' + | ||
'variable names prefixed with `mock` are permitted.');}} | ||
@@ -115,0 +121,0 @@ |
{ | ||
"name": "babel-plugin-jest-hoist", | ||
"version": "13.2.2", | ||
"version": "13.3.0-alpha.4eb0c908", | ||
"repository": { | ||
@@ -15,3 +15,3 @@ "type": "git", | ||
"jest": { | ||
"rootDir": "./build", | ||
"rootDir": "./src", | ||
"scriptPreprocessor": "../../babel-jest", | ||
@@ -18,0 +18,0 @@ "testEnvironment": "node" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7814
12
183
2
1