New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jest-runtime

Package Overview
Dependencies
Maintainers
3
Versions
306
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-runtime - npm Package Compare versions

Comparing version 13.3.0-alpha.g8b48d59 to 13.4.0-alpha.d2632006

2

build/cli/index.js

@@ -64,3 +64,3 @@ /**

then(config => {
Runtime.buildHasteMap(config, {
Runtime.createHasteContext(config, {
maxWorkers: os.cpus().length - 1 }).

@@ -67,0 +67,0 @@

@@ -18,5 +18,5 @@ /**

const HasteMap = require('jest-haste-map');
const Resolver = require('jest-resolve');
const createHasteMap = require('jest-haste-map').create;
const createResolver = require('jest-resolve').create;
const fs = require('graceful-fs');

@@ -41,4 +41,19 @@ const moduleMocker = require('jest-mock');

const NODE_MODULES = path.sep + 'node_modules' + path.sep;
const SNAPSHOT_EXTENSION = 'snap';
const getModuleNameMapper = config => {
if (config.moduleNameMapper.length) {
const moduleNameMapper = Object.create(null);
config.moduleNameMapper.forEach(
map => moduleNameMapper[map[1]] = new RegExp(map[0]));
return moduleNameMapper;}
return null;};
const mockParentModule = {

@@ -138,3 +153,3 @@ exports: {},

static buildHasteMap(
static createHasteContext(
config,

@@ -144,3 +159,3 @@ options)

utils.createDirectory(config.cacheDirectory);
const instance = createHasteMap(config, {
const instance = Runtime.createHasteMap(config, {
maxWorkers: options.maxWorkers,

@@ -153,3 +168,3 @@ resetCache: !config.cache });

moduleMap,
resolver: createResolver(config, moduleMap) }),
resolver: Runtime.createResolver(config, moduleMap) }),

@@ -162,2 +177,41 @@ error => {

static createHasteMap(
config,
options)
{
const ignorePattern = new RegExp(
[config.cacheDirectory].concat(config.modulePathIgnorePatterns).join('|'));
return new HasteMap({
cacheDirectory: config.cacheDirectory,
extensions: [SNAPSHOT_EXTENSION].concat(config.moduleFileExtensions),
ignorePattern,
maxWorkers: options && options.maxWorkers || 1,
mocksPattern: config.mocksPattern,
name: config.name,
platforms: config.haste.platforms || ['ios', 'android'],
providesModuleNodeModules: config.haste.providesModuleNodeModules,
resetCache: options && options.resetCache,
roots: config.testPathDirs,
useWatchman: config.watchman });}
static createResolver(
config,
moduleMap)
{
return new Resolver(moduleMap, {
browser: config.browser,
defaultPlatform: config.haste.defaultPlatform,
extensions: config.moduleFileExtensions.map(extension => '.' + extension),
hasCoreModules: true,
moduleDirectories: config.moduleDirectories,
moduleNameMapper: getModuleNameMapper(config),
modulePaths: config.modulePaths,
platforms: config.haste.platforms });}
static runCLI(args, info) {

@@ -171,3 +225,7 @@ return require('./cli').run(args, info);}

requireModule(from, moduleName) {
requireModule(
from,
moduleName,
options)
{
const moduleID = this._normalizeID(from, moduleName);

@@ -183,2 +241,3 @@ let modulePath;

if (
(!options || !options.isInternalModule) &&
!moduleResource &&

@@ -209,3 +268,2 @@ manualMockResource &&

this._moduleRegistry[modulePath] = localModule;

@@ -220,3 +278,3 @@ if (path.extname(modulePath) === '.json') {

{
this._execModule(localModule);}}
this._execModule(localModule, options);}}

@@ -227,2 +285,6 @@

requireInternalModule(from, to) {
return this.requireModule(from, to, { isInternalModule: true });}
requireMock(from, moduleName) {

@@ -348,11 +410,11 @@ const moduleID = this._normalizeID(from, moduleName);

return (
shouldCollectCoverage &&
!this._coverageRegex.test(filename) &&
!(this._mocksPattern && this._mocksPattern.test(filename)) &&
!this._testRegex.test(filename));}
return !!(
shouldCollectCoverage &&
!this._coverageRegex.test(filename) &&
!(this._mocksPattern && this._mocksPattern.test(filename)) &&
!this._testRegex.test(filename));}
_execModule(localModule) {
_execModule(localModule, options) {
// If the environment was disposed, prevent this module from being executed.

@@ -364,3 +426,5 @@ if (!this._environment.global) {

const filename = localModule.filename;
const shouldCollectCoverage = this._shouldCollectCoverage(filename);
const shouldCollectCoverage =
(!options || !options.isInternalModule) &&
this._shouldCollectCoverage(filename);
const collectors = this._coverageCollectors;

@@ -382,13 +446,15 @@ if (shouldCollectCoverage && !collectors[filename]) {

localModule.paths = this._resolver.getModulePaths(dirname);
localModule.require = this._createRequireImplementation(filename);
localModule.require = this._createRequireImplementation(filename, options);
const script = transform(filename, this._config, {
instrument: shouldCollectCoverage && (
source => collectors[filename].getInstrumentedSource(
const script = transform(
filename,
options && options.isInternalModule ? null : this._config,
shouldCollectCoverage ? {
instrument: source => collectors[filename].getInstrumentedSource(
source,
filename,
'$JEST')) });
'$JEST') } :
null);
const wrapper = this._runScript(script, filename);

@@ -610,9 +676,14 @@ wrapper.call(

_createRequireImplementation(from) {
const moduleRequire = this.requireModuleOrMock.bind(this, from);
_createRequireImplementation(
from,
options)
{
const moduleRequire = options && options.isInternalModule ?
moduleName => this.requireInternalModule(from, moduleName) :
this.requireModuleOrMock.bind(this, from);
moduleRequire.cache = Object.create(null);
moduleRequire.extensions = Object.create(null);
moduleRequire.requireActual = this.requireModule.bind(this, from);
moduleRequire.requireMock = this.requireMock.bind(this, from);
moduleRequire.requireActual = this.requireModule.bind(this, from);
moduleRequire.resolve = moduleName => this._resolveModule(from, moduleName);
moduleRequire.cache = Object.create(null);
moduleRequire.extensions = Object.create(null);
return moduleRequire;}

@@ -619,0 +690,0 @@

@@ -14,6 +14,5 @@ /**

const Resolver = require('jest-resolve');
const createDirectory = require('jest-util').createDirectory;
const crypto = require('crypto');
const fileExists = require('jest-file-exists');
const fs = require('graceful-fs');

@@ -68,3 +67,3 @@ const getCacheFilePath = require('jest-haste-map').getCacheFilePath;

const configStr = configToJsonMap.get(config);
const configStr = configToJsonMap.get(config) || '';
if (typeof preprocessor.getCacheKey === 'function') {

@@ -95,3 +94,3 @@ return preprocessor.getCacheKey(fileData, filePath, configStr);} else

const readCacheFile = (filePath, cachePath) => {
if (!Resolver.fileExists(cachePath)) {
if (!fileExists(cachePath)) {
return null;}

@@ -123,6 +122,7 @@

const mtime = fs.statSync(filename).mtime;
const mapCacheKey = filename + '_' + mtime.getTime();
const instrumentCacheKey = options && options.instrument ? '1' : '0';
const key = filename + '-' + mtime.getTime() + '-' + instrumentCacheKey;
if (cache.has(mapCacheKey)) {
const content = cache.get(mapCacheKey);
if (cache.has(key)) {
const content = cache.get(key);
if (content) {

@@ -140,3 +140,3 @@ return content;}}

if (!ignoreCache.has(config)) {
if (config && !ignoreCache.has(config)) {
ignoreCache.set(

@@ -149,2 +149,3 @@ config,

if (
config &&
config.scriptPreprocessor && (

@@ -169,3 +170,6 @@

const cacheKey = getCacheKey(preprocessor, content, filename, config);
const cacheKey =
getCacheKey(preprocessor, content, filename, config) +
instrumentCacheKey;
// Create sub folders based on the cacheKey to avoid creating one

@@ -202,3 +206,3 @@ // directory with many files.

cache.set(mapCacheKey, script);
cache.set(key, script);
return script;};

@@ -205,0 +209,0 @@

{
"name": "jest-runtime",
"version": "13.3.0-alpha.g8b48d59",
"version": "13.4.0-alpha.d2632006",
"repository": {

@@ -13,8 +13,9 @@ "type": "git",

"graceful-fs": "^4.1.3",
"jest-config": "^13.3.0-alpha.g8b48d59",
"jest-haste-map": "^13.3.0-alpha.g8b48d59",
"jest-mock": "^13.3.0-alpha.g8b48d59",
"jest-resolve": "^13.3.0-alpha.g8b48d59",
"jest-snapshot": "^13.3.0-alpha.g8b48d59",
"jest-util": "^13.3.0-alpha.g8b48d59",
"jest-config": "^13.4.0-alpha.d2632006",
"jest-file-exists": "^13.4.0-alpha.d2632006",
"jest-haste-map": "^13.4.0-alpha.d2632006",
"jest-mock": "^13.4.0-alpha.d2632006",
"jest-resolve": "^13.4.0-alpha.d2632006",
"jest-snapshot": "^13.4.0-alpha.d2632006",
"jest-util": "^13.4.0-alpha.d2632006",
"json-stable-stringify": "^1.0.0",

@@ -27,4 +28,4 @@ "yargs": "^4.7.1"

"devDependencies": {
"jest-config": "^13.3.0-alpha.g8b48d59",
"jest-environment-node": "^13.3.0-alpha.g8b48d59"
"jest-config": "^13.4.0-alpha.d2632006",
"jest-environment-node": "^13.4.0-alpha.d2632006"
},

@@ -31,0 +32,0 @@ "jest": {

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