babel-jest
Advanced tools
Comparing version 18.0.0 to 18.5.0-alpha.7da3df39
@@ -16,3 +16,2 @@ /** | ||
const babel = require('babel-core'); | ||
const crypto = require('crypto'); | ||
@@ -24,5 +23,8 @@ const fs = require('fs'); | ||
const BABELRC_FILENAME = '.babelrc'; | ||
const THIS_FILE = fs.readFileSync(__filename); | ||
const cache = Object.create(null); | ||
let babel; | ||
const getBabelRC = (filename, _ref) => {let useCache = _ref.useCache; | ||
@@ -52,3 +54,3 @@ const paths = []; | ||
options = Object.assign({}, options, { | ||
auxiliaryCommentBefore: ' istanbul ignore next ', | ||
plugins: options && options.plugins || [], | ||
presets: (options && options.presets || []).concat([jestPreset]), | ||
@@ -58,2 +60,3 @@ retainLines: true }); | ||
delete options.cacheDirectory; | ||
delete options.filename; | ||
@@ -69,7 +72,12 @@ return { | ||
return crypto.createHash('md5'). | ||
update(THIS_FILE). | ||
update('\0', 'utf8'). | ||
update(fileData). | ||
update(configString) | ||
update('\0', 'utf8'). | ||
update(configString). | ||
update('\0', 'utf8') | ||
// Don't use the in-memory cache in watch mode because the .babelrc | ||
// file may be modified. | ||
.update(getBabelRC(filename, { useCache: !watch })). | ||
update('\0', 'utf8'). | ||
update(instrument ? 'instrument' : ''). | ||
@@ -84,7 +92,16 @@ digest('hex'); | ||
{ | ||
let plugins = options.plugins || []; | ||
if (!babel) { | ||
babel = require('babel-core'); | ||
} | ||
if (!babel.util.canCompile(filename)) { | ||
return src; | ||
} | ||
const theseOptions = Object.assign({ filename }, options); | ||
if (transformOptions && transformOptions.instrument) { | ||
theseOptions.auxiliaryCommentBefore = ' istanbul ignore next '; | ||
// Copied from jest-runtime transform.js | ||
plugins = plugins.concat([ | ||
theseOptions.plugins = theseOptions.plugins.concat([ | ||
[ | ||
@@ -101,9 +118,3 @@ require('babel-plugin-istanbul').default, | ||
if (babel.util.canCompile(filename)) { | ||
return babel.transform( | ||
src, | ||
Object.assign({}, options, { filename, plugins })). | ||
code; | ||
} | ||
return src; | ||
return babel.transform(src, theseOptions).code; | ||
} }; | ||
@@ -110,0 +121,0 @@ |
{ | ||
"name": "babel-jest", | ||
"version": "18.0.0", | ||
"version": "18.5.0-alpha.7da3df39", | ||
"repository": { | ||
@@ -12,5 +12,5 @@ "type": "git", | ||
"babel-core": "^6.0.0", | ||
"babel-plugin-istanbul": "^3.0.0", | ||
"babel-preset-jest": "^18.0.0" | ||
"babel-plugin-istanbul": "^4.0.0", | ||
"babel-preset-jest": "^18.5.0-alpha.7da3df39" | ||
} | ||
} |
@@ -23,4 +23,4 @@ # babel-jest | ||
"transform": { | ||
"^.+\\.js$": "<rootDir>/node_modules/babel-jest" | ||
"^.+\\.jsx?$": "babel-jest" | ||
}, | ||
``` |
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
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
4193
93
2
+ Addedbabel-plugin-istanbul@4.1.6(transitive)
+ Addedbabel-plugin-jest-hoist@18.5.0-alpha.7da3df39(transitive)
+ Addedbabel-plugin-syntax-object-rest-spread@6.13.0(transitive)
+ Addedbabel-preset-jest@18.5.0-alpha.7da3df39(transitive)
+ Addedfind-up@2.1.0(transitive)
+ Addedlocate-path@2.0.0(transitive)
+ Addedp-limit@1.3.0(transitive)
+ Addedp-locate@2.0.0(transitive)
+ Addedp-try@1.0.0(transitive)
+ Addedpath-exists@3.0.0(transitive)
+ Addedtest-exclude@4.2.3(transitive)
- Removedbabel-plugin-istanbul@3.1.2(transitive)
- Removedbabel-plugin-jest-hoist@18.0.0(transitive)
- Removedbabel-preset-jest@18.0.0(transitive)
- Removedtest-exclude@3.3.0(transitive)
Updatedbabel-plugin-istanbul@^4.0.0