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
1
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.2.3 to 13.3.0-alpha.4eb0c908

build/transform.js

3

build/cli/index.js

@@ -14,2 +14,3 @@ /**

const args = require('./args');
const chalk = require('chalk');
const os = require('os');

@@ -79,3 +80,3 @@ const path = require('path');

catch(e => {
console.error(e);
console.error(chalk.red(e));
process.on('exit', () => process.exit(1));});});}

@@ -82,0 +83,0 @@

@@ -18,2 +18,3 @@ /**

const createHasteMap = require('jest-haste-map').create;

@@ -24,3 +25,3 @@ const createResolver = require('jest-resolve').create;

const path = require('path');
const transform = require('./lib/transform');
const transform = require('./transform');
const utils = require('jest-util');

@@ -332,5 +333,18 @@

_shouldCollectCoverage(filename) {
const collectOnlyFrom = this._config.collectCoverageOnlyFrom;
const shouldCollectCoverage =
this._config.collectCoverage && !collectOnlyFrom ||
collectOnlyFrom && collectOnlyFrom[filename];
return (
shouldCollectCoverage &&
!this._coverageRegex.test(filename) &&
!(this._mocksPattern && this._mocksPattern.test(filename)) &&
!this._testRegex.test(filename));}
_execModule(localModule) {
// If the environment was disposed, prevent this module from
// being executed.
// If the environment was disposed, prevent this module from being executed.
if (!this._environment.global) {

@@ -341,27 +355,10 @@ return;}

const filename = localModule.filename;
const shouldCollectCoverage = this._shouldCollectCoverage(filename);
const collectors = this._coverageCollectors;
const collectOnlyFrom = this._config.collectCoverageOnlyFrom;
const shouldCollectCoverage =
this._config.collectCoverage && !collectOnlyFrom ||
collectOnlyFrom && collectOnlyFrom[filename];
if (shouldCollectCoverage && !collectors[filename]) {
collectors[filename] = new this._CoverageCollector();}
let moduleContent = transform(filename, this._config);
let collectorStore;
if (
shouldCollectCoverage &&
!this._coverageRegex.test(filename) &&
!(this._mocksPattern && this._mocksPattern.test(filename)) &&
!this._testRegex.test(filename))
{
if (!collectors[filename]) {
collectors[filename] = new this._CoverageCollector(
moduleContent,
filename);}
const collectorStore =
shouldCollectCoverage && collectors[filename].getCoverageDataStore();
const collector = collectors[filename];
collectorStore = collector.getCoverageDataStore();
moduleContent = collector.getInstrumentedSource('$JEST_COVERAGE_DATA');}
const lastExecutingModulePath = this._currentlyExecutingModulePath;

@@ -378,4 +375,13 @@ this._currentlyExecutingModulePath = filename;

const wrapperFunc = this._runSourceText(moduleContent, filename);
wrapperFunc.call(
const script = transform(filename, this._config, {
instrument: shouldCollectCoverage && (
source => collectors[filename].getInstrumentedSource(
source,
filename,
'$JEST')) });
const wrapper = this._runScript(script, filename);
wrapper.call(
localModule.exports, // module context

@@ -389,3 +395,3 @@ localModule, // module object

this._createRuntimeFor(filename), // jest object
collectorStore);
collectorStore); // the coverage object

@@ -397,12 +403,10 @@

_runSourceText(moduleContent, filename) {
/* eslint-disable max-len */
const config = this._config;
const relative = filePath => path.relative(config.rootDir, filePath);
const env = this._environment;
const evalResultVariable = 'Object.<anonymous>';
const wrapper = '({ "' + evalResultVariable + '": function(module, exports, require, __dirname, __filename, global, jest, $JEST_COVERAGE_DATA) {' + moduleContent + '\n}});';
_runScript(script, filename) {
try {
return env.runSourceText(wrapper, filename)[evalResultVariable];}
return this._environment.runScript(script)[
transform.EVAL_RESULT_VARIABLE];}
catch (e) {
const config = this._config;
const relative = filePath => path.relative(config.rootDir, filePath);
if (e.constructor.name === 'SyntaxError') {

@@ -417,2 +421,3 @@ const hasPreprocessor = config.scriptPreprocessor;

'';
/* eslint-disable max-len */
throw new SyntaxError(

@@ -423,9 +428,8 @@ `${ e.message } in file '${ relative(filename) }'.\n\n` +

'If you are currently setting up Jest or modifying your preprocessor, try `jest --no-cache`.\n' +
`Preprocessor: ${ preprocessorInfo }.\n${ babelInfo }` +
`Jest tried to the execute the following ${ hasPreprocessor ? 'preprocessed ' : '' }code:\n${ moduleContent }\n`);}
`Preprocessor: ${ preprocessorInfo }.\n${ babelInfo }`);
/* eslint-enable max-len */}
throw e;}
throw e;}}
/* eslint-enable max-len */}

@@ -672,3 +676,2 @@

clearAllTimers: () => this._environment.fakeTimers.clearAllTimers(),
currentTestPath: () => this._environment.testFilePath,

@@ -675,0 +678,0 @@ dontMock: unmock,

{
"name": "jest-runtime",
"version": "13.2.3",
"version": "13.3.0-alpha.4eb0c908",
"repository": {

@@ -11,10 +11,10 @@ "type": "git",

"dependencies": {
"chalk": "^1.1.3",
"graceful-fs": "^4.1.3",
"jest-config": "^13.2.3",
"jest-environment-jsdom": "^13.2.2",
"jest-haste-map": "^13.2.2",
"jest-mock": "^13.2.2",
"jest-resolve": "^13.2.2",
"jest-snapshot": "^13.2.3",
"jest-util": "^13.2.2",
"jest-config": "^13.3.0-alpha.4eb0c908",
"jest-haste-map": "^13.3.0-alpha.4eb0c908",
"jest-mock": "^13.3.0-alpha.4eb0c908",
"jest-resolve": "^13.3.0-alpha.4eb0c908",
"jest-snapshot": "^13.3.0-alpha.4eb0c908",
"jest-util": "^13.3.0-alpha.4eb0c908",
"json-stable-stringify": "^1.0.0",

@@ -27,8 +27,11 @@ "yargs": "^4.7.1"

"devDependencies": {
"jest-config": "^13.2.3"
"jest-config": "^13.3.0-alpha.4eb0c908",
"jest-environment-node": "^13.3.0-alpha.4eb0c908"
},
"jest": {
"automock": false,
"rootDir": "./build",
"testEnvironment": "jest-environment-node",
"rootDir": "./src",
"scriptPreprocessor": "../../babel-jest",
"setupTestFrameworkScriptFile": "<rootDir>/__mocks__/env.js",
"testEnvironment": "node",
"testPathIgnorePatterns": [

@@ -35,0 +38,0 @@ "/__tests__/[^/]*/.+"

Sorry, the diff of this file is not supported yet

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