babel-jest
Advanced tools
Comparing version 16.1.0-alpha.691b0e22 to 17.0.0
@@ -17,4 +17,33 @@ /** | ||
const babel = require('babel-core'); | ||
const crypto = require('crypto'); | ||
const fs = require('fs'); | ||
const jestPreset = require('babel-preset-jest'); | ||
const path = require('path'); | ||
const BABELRC_FILENAME = '.babelrc'; | ||
const cache = Object.create(null); | ||
const getBabelRC = (filename, _ref) => {let useCache = _ref.useCache; | ||
const paths = []; | ||
let directory = filename; | ||
while (directory !== (directory = path.dirname(directory))) { | ||
if (useCache && cache[directory]) { | ||
break; | ||
} | ||
paths.push(directory); | ||
const configFilePath = path.join(directory, BABELRC_FILENAME); | ||
if (fs.existsSync(configFilePath)) { | ||
cache[directory] = fs.readFileSync(configFilePath, 'utf8'); | ||
break; | ||
} | ||
} | ||
paths.forEach(directoryPath => { | ||
cache[directoryPath] = cache[directory]; | ||
}); | ||
return cache[directory] || ''; | ||
}; | ||
const createTransformer = options => { | ||
@@ -49,2 +78,17 @@ options = Object.assign({}, options, { | ||
return src; | ||
}, | ||
getCacheKey( | ||
fileData, | ||
filename, | ||
configString, _ref2) | ||
{let instrument = _ref2.instrument,watch = _ref2.watch; | ||
return crypto.createHash('md5'). | ||
update(fileData). | ||
update(configString) | ||
// Don't use the in-memory cache in watch mode because the .babelrc | ||
// file may be modified. | ||
.update(getBabelRC(filename, { useCache: !watch })). | ||
update(instrument ? 'instrument' : ''). | ||
digest('hex'); | ||
} }; | ||
@@ -51,0 +95,0 @@ |
{ | ||
"name": "babel-jest", | ||
"version": "16.1.0-alpha.691b0e22", | ||
"version": "17.0.0", | ||
"repository": { | ||
@@ -13,4 +13,4 @@ "type": "git", | ||
"babel-plugin-istanbul": "^2.0.0", | ||
"babel-preset-jest": "^16.1.0-alpha.691b0e22" | ||
"babel-preset-jest": "^16.0.0" | ||
} | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3354
78
1
1
+ Addedbabel-plugin-jest-hoist@16.0.0(transitive)
+ Addedbabel-preset-jest@16.0.0(transitive)
- Removedbabel-plugin-jest-hoist@16.1.0-alpha.691b0e22(transitive)
- Removedbabel-preset-jest@16.1.0-alpha.691b0e22(transitive)
Updatedbabel-preset-jest@^16.0.0