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
4
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 15.1.1 to 15.2.0-alpha.c681f819

84

build/index.js

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

const HasteMap = require('jest-haste-map');
const ResolverClass = require('jest-resolve');
const Resolver = require('jest-resolve');
const fs = require('graceful-fs');
const moduleMocker = require('jest-mock');
const path = require('path');

@@ -49,2 +48,5 @@ const shouldInstrument = require('./shouldInstrument');

const NODE_MODULES = path.sep + 'node_modules' + path.sep;

@@ -95,2 +97,4 @@ const SNAPSHOT_EXTENSION = 'snap';

constructor(

@@ -102,2 +106,3 @@ config,

this._moduleRegistry = Object.create(null);
this._internalModuleRegistry = Object.create(null);
this._mockRegistry = Object.create(null);

@@ -107,2 +112,3 @@ this._config = config;

this._resolver = resolver;
this._moduleMocker = this._environment.moduleMocker;

@@ -153,2 +159,15 @@ this._currentlyExecutingModulePath = '';

static shouldInstrument(filename, config) {
return shouldInstrument(filename, config);
}
static transformSource(
filename,
config,
content,
instrument)
{
return transform.transformSource(filename, config, content, instrument);
}
static createHasteContext(

@@ -197,2 +216,3 @@ config,

resetCache: options && options.resetCache,
retainAllFiles: false,
roots: config.testPathDirs,

@@ -207,3 +227,3 @@ useWatchman: config.watchman });

{
return new ResolverClass(moduleMap, {
return new Resolver(moduleMap, {
browser: config.browser,

@@ -236,2 +256,6 @@ defaultPlatform: config.haste.defaultPlatform,

const moduleRegistry = !options || !options.isInternalModule ?
this._moduleRegistry :
this._internalModuleRegistry;
// Some old tests rely on this mocking behavior. Ideally we'll change this

@@ -261,3 +285,3 @@ // to be more explicit.

if (!this._moduleRegistry[modulePath]) {
if (!moduleRegistry[modulePath]) {
// We must register the pre-allocated module object first so that any

@@ -267,6 +291,7 @@ // circular dependencies that may arise while evaluating the module can

const localModule = {
exports: {},
filename: modulePath,
exports: {} };
id: modulePath };
this._moduleRegistry[modulePath] = localModule;
moduleRegistry[modulePath] = localModule;
if (path.extname(modulePath) === '.json') {

@@ -283,3 +308,3 @@ localModule.exports = this._environment.global.JSON.parse(

}
return this._moduleRegistry[modulePath].exports;
return moduleRegistry[modulePath].exports;
}

@@ -333,3 +358,4 @@

exports: {},
filename: modulePath };
filename: modulePath,
id: modulePath };

@@ -395,2 +421,6 @@ this._execModule(localModule);

clearAllMocks() {
this._moduleMocker.clearAllMocks();
}
_resolveModule(from, to) {

@@ -458,3 +488,3 @@ return to ? this._resolver.resolveModule(from, to) : from;

`Make sure your preprocessor is set up correctly and ensure ` +
`your 'preprocessorIgnorePatterns' configuration is correct: http://facebook.github.io/jest/docs/api.html#preprocessorignorepatterns-array-string\n` +
`your 'preprocessorIgnorePatterns' configuration is correct: http://facebook.github.io/jest/docs/configuration.html#preprocessorignorepatterns-array-string\n` +
'If you are currently setting up Jest or modifying your preprocessor, try `jest --no-cache`.\n' +

@@ -475,3 +505,4 @@ `Preprocessor: ${ preprocessorInfo }.\n${ babelInfo }`);

// automock
this._mockMetaDataCache[modulePath] = moduleMocker.getMetadata({});
this._mockMetaDataCache[modulePath] =
this._moduleMocker.getMetadata({});

@@ -493,4 +524,4 @@ // In order to avoid it being possible for automocking to potentially

const mockMetadata = moduleMocker.getMetadata(moduleExports);
if (mockMetadata === null) {
const mockMetadata = this._moduleMocker.getMetadata(moduleExports);
if (mockMetadata == null) {
throw new Error(

@@ -503,3 +534,3 @@ `Failed to get mock metadata: ${ modulePath }\n\n` +

}
return moduleMocker.generateFromMetadata(
return this._moduleMocker.generateFromMetadata(
this._mockMetaDataCache[modulePath]);

@@ -700,2 +731,6 @@

};
const clearAllMocks = () => {
this.clearAllMocks();
return runtime;
};
const useFakeTimers = () => {

@@ -736,12 +771,13 @@ this._environment.fakeTimers.useFakeTimers();

},
genMockFunction: moduleMocker.getMockFunction,
genMockFn: moduleMocker.getMockFunction,
fn() {
const fn = moduleMocker.getMockFunction();
if (arguments.length > 0) {
return fn.mockImplementation(arguments[0]);
genMockFunction:
this._moduleMocker.getMockFunction.bind(this._moduleMocker),
genMockFn: this._moduleMocker.getMockFunction.bind(this._moduleMocker),
fn: impl => {
const fn = this._moduleMocker.getMockFunction();
if (impl) {
return fn.mockImplementation(impl);
}
return fn;
},
isMockFunction: moduleMocker.isMockFunction,
isMockFunction: this._moduleMocker.isMockFunction,

@@ -751,2 +787,4 @@ doMock: mock,

clearAllMocks,
resetModules,

@@ -758,2 +796,4 @@ resetModuleRegistry: resetModules,

runAllTimers: () => this._environment.fakeTimers.runAllTimers(),
runTimersToTime: msToRun =>
this._environment.fakeTimers.runTimersToTime(msToRun),
runOnlyPendingTimers: () =>

@@ -774,4 +814,2 @@ this._environment.fakeTimers.runOnlyPendingTimers(),

module.exports = Runtime;
module.exports.shouldInstrument = shouldInstrument;
module.exports.transformSource = transform.transformSource;
module.exports = Runtime;
{
"name": "jest-runtime",
"version": "15.1.1",
"version": "15.2.0-alpha.c681f819",
"repository": {

@@ -12,13 +12,13 @@ "type": "git",

"babel-core": "^6.11.4",
"babel-jest": "^15.0.0",
"babel-jest": "^15.2.0-alpha.c681f819",
"babel-plugin-istanbul": "^2.0.0",
"chalk": "^1.1.3",
"graceful-fs": "^4.1.6",
"jest-config": "^15.1.1",
"jest-file-exists": "^15.0.0",
"jest-haste-map": "^15.0.1",
"jest-mock": "^15.0.0",
"jest-resolve": "^15.0.1",
"jest-snapshot": "^15.1.1",
"jest-util": "^15.1.1",
"jest-config": "^15.2.0-alpha.c681f819",
"jest-file-exists": "^15.2.0-alpha.c681f819",
"jest-haste-map": "^15.2.0-alpha.c681f819",
"jest-mock": "^15.2.0-alpha.c681f819",
"jest-resolve": "^15.2.0-alpha.c681f819",
"jest-snapshot": "^15.2.0-alpha.c681f819",
"jest-util": "^15.2.0-alpha.c681f819",
"json-stable-stringify": "^1.0.0",

@@ -32,5 +32,5 @@ "multimatch": "^2.1.0",

"devDependencies": {
"jest-config": "^15.1.1",
"jest-environment-node": "^15.1.1",
"jest-environment-jsdom": "^15.1.1"
"jest-config": "^15.2.0-alpha.c681f819",
"jest-environment-node": "^15.2.0-alpha.c681f819",
"jest-environment-jsdom": "^15.2.0-alpha.c681f819"
},

@@ -37,0 +37,0 @@ "scripts": {

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