Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jest/transform

Package Overview
Dependencies
Maintainers
7
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/transform - npm Package Compare versions

Comparing version 26.0.1 to 26.1.0

44

build/ScriptTransformer.js

@@ -330,4 +330,2 @@ 'use strict';

_getTransformer(filename) {
let transform = null;
if (!this._config.transform || !this._config.transform.length) {

@@ -339,30 +337,32 @@ return null;

if (transformPath) {
const transformer = this._transformCache.get(transformPath);
if (!transformPath) {
return null;
}
if (transformer != null) {
return transformer;
}
const transformer = this._transformCache.get(transformPath);
transform = require(transformPath);
if (transformer) {
return transformer;
}
if (!transform) {
throw new TypeError('Jest: a transform must export something.');
}
let transform = require(transformPath);
const transformerConfig = this._transformConfigCache.get(transformPath);
if (!transform) {
throw new TypeError('Jest: a transform must export something.');
}
if (typeof transform.createTransformer === 'function') {
transform = transform.createTransformer(transformerConfig);
}
const transformerConfig = this._transformConfigCache.get(transformPath);
if (typeof transform.process !== 'function') {
throw new TypeError(
'Jest: a transform must export a `process` function.'
);
}
if (typeof transform.createTransformer === 'function') {
transform = transform.createTransformer(transformerConfig);
}
this._transformCache.set(transformPath, transform);
if (typeof transform.process !== 'function') {
throw new TypeError(
'Jest: a transform must export a `process` function.'
);
}
this._transformCache.set(transformPath, transform);
return transform;

@@ -702,3 +702,3 @@ }

*/
// @ts-ignore: Unused and private - remove in Jest 25
// @ts-expect-error: Unused and private - remove in Jest 25

@@ -705,0 +705,0 @@ _shouldTransform(filename) {

@@ -105,3 +105,15 @@ 'use strict';

);
const cachedRegexes = new Map();
const getRegex = regexStr => {
if (!cachedRegexes.has(regexStr)) {
cachedRegexes.set(regexStr, new RegExp(regexStr));
}
const regex = cachedRegexes.get(regexStr); // prevent stateful regexes from breaking, just in case
regex.lastIndex = 0;
return regex;
};
function shouldInstrument(filename, options, config) {

@@ -120,3 +132,5 @@ if (!options.collectCoverage) {

if (
!config.testPathIgnorePatterns.some(pattern => !!filename.match(pattern))
!config.testPathIgnorePatterns.some(pattern =>
getRegex(pattern).test(filename)
)
) {

@@ -128,6 +142,5 @@ if (config.testRegex.some(regex => new RegExp(regex).test(filename))) {

if (
(0, _micromatch().default)(
[(0, _jestUtil().replacePathSepForGlob)(filename)],
config.testMatch
).length
(0, _jestUtil().globsToMatcher)(config.testMatch)(
(0, _jestUtil().replacePathSepForGlob)(filename)
)
) {

@@ -151,10 +164,7 @@ return false;

options.collectCoverageFrom.length &&
(0, _micromatch().default)(
[
(0, _jestUtil().replacePathSepForGlob)(
path().relative(config.rootDir, filename)
)
],
options.collectCoverageFrom
).length === 0
!(0, _jestUtil().globsToMatcher)(options.collectCoverageFrom)(
(0, _jestUtil().replacePathSepForGlob)(
path().relative(config.rootDir, filename)
)
)
) {

@@ -161,0 +171,0 @@ return false;

{
"name": "@jest/transform",
"version": "26.0.1",
"version": "26.1.0",
"repository": {

@@ -14,3 +14,3 @@ "type": "git",

"@babel/core": "^7.1.0",
"@jest/types": "^26.0.1",
"@jest/types": "^26.1.0",
"babel-plugin-istanbul": "^6.0.0",

@@ -21,5 +21,5 @@ "chalk": "^4.0.0",

"graceful-fs": "^4.2.4",
"jest-haste-map": "^26.0.1",
"jest-haste-map": "^26.1.0",
"jest-regex-util": "^26.0.0",
"jest-util": "^26.0.1",
"jest-util": "^26.1.0",
"micromatch": "^4.0.2",

@@ -47,3 +47,3 @@ "pirates": "^4.0.1",

},
"gitHead": "40b8e1e157c9981dda5a68d73fff647e80fc9f5c"
"gitHead": "817d8b6aca845dd4fcfd7f8316293e69f3a116c5"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc