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

jest-config

Package Overview
Dependencies
Maintainers
3
Versions
308
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-config - npm Package Compare versions

Comparing version 19.2.0-alpha.993e64af to 19.3.0-alpha.85402254

48

build/findConfig.js

@@ -16,14 +16,47 @@ /**

const fs = require('fs');
const jsonlint = require('./vendor/jsonlint');
const path = require('path');
const JEST_CONFIG = 'jest.config.js';
const PACAKAGE_JSON = 'package.json';
const PACKAGE_JSON = 'package.json';
const isFile = filePath =>
fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory();
const findConfig = root => {
let directory = root;
// $FlowFixMe
let options = {};
let directory = root;
const isJS = directory.endsWith('.js');
if ((isJS || directory.endsWith('.json')) && isFile(directory)) {
const filePath = path.resolve(process.cwd(), directory);
if (isJS) {
// $FlowFixMe
options = require(filePath);
} else {
let pkg;
try {
// $FlowFixMe
pkg = require(filePath);
} catch (error) {
throw new Error(
`Jest: Failed to parse config file ${filePath}\n` +
` ${jsonlint.errors(fs.readFileSync(filePath, 'utf8'))}`);
}
if (directory.endsWith(PACKAGE_JSON)) {
options = pkg.jest || options;
} else {
options = pkg;
}
}
options.rootDir = options.rootDir ?
path.resolve(path.dirname(directory), options.rootDir) :
path.dirname(directory);
return options;
}
do {
const configJsFilePath = path.join(directory, JEST_CONFIG);
if (fs.existsSync(configJsFilePath)) {
if (isFile(configJsFilePath)) {
// $FlowFixMe

@@ -33,4 +66,5 @@ options = require(configJsFilePath);

}
const packageJsonFilePath = path.join(directory, PACAKAGE_JSON);
if (fs.existsSync(packageJsonFilePath)) {
const packageJsonFilePath = path.join(directory, PACKAGE_JSON);
if (isFile(packageJsonFilePath)) {
// $FlowFixMe

@@ -46,5 +80,7 @@ const pkg = require(packageJsonFilePath);

} while (directory !== (directory = path.dirname(directory)));
options.rootDir = options.rootDir ?
path.resolve(root, options.rootDir) :
root;
directory;
return options;

@@ -51,0 +87,0 @@ };

9

build/index.js

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

const findConfig = require('./findConfig');
const loadFromFile = require('./loadFromFile');
const normalize = require('./normalize');

@@ -47,6 +46,2 @@ const path = require('path');

if (typeof rawOptions === 'string') {
return loadFromFile(path.resolve(process.cwd(), rawOptions));
}
if (typeof rawOptions === 'object') {

@@ -58,2 +53,6 @@ const config = Object.assign({}, rawOptions);

if (typeof rawOptions === 'string') {
root = path.resolve(process.cwd(), rawOptions);
}
return findConfig(root);

@@ -60,0 +59,0 @@ };

@@ -384,3 +384,3 @@ /**

'haste.hasteImplModulePath',
value.hasteImplModulePath);
_replaceRootDirInPath(options.rootDir, value.hasteImplModulePath));

@@ -387,0 +387,0 @@ }

{
"name": "jest-config",
"version": "19.2.0-alpha.993e64af",
"version": "19.3.0-alpha.85402254",
"repository": {

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

"glob": "^7.1.1",
"jest-environment-jsdom": "^19.2.0-alpha.993e64af",
"jest-environment-node": "^19.2.0-alpha.993e64af",
"jest-jasmine2": "^19.2.0-alpha.993e64af",
"jest-regex-util": "^19.2.0-alpha.993e64af",
"jest-resolve": "^19.2.0-alpha.993e64af",
"jest-validate": "^19.2.0-alpha.993e64af",
"pretty-format": "^19.2.0-alpha.993e64af"
"jest-environment-jsdom": "^19.3.0-alpha.85402254",
"jest-environment-node": "^19.3.0-alpha.85402254",
"jest-jasmine2": "^19.3.0-alpha.85402254",
"jest-regex-util": "^19.3.0-alpha.85402254",
"jest-resolve": "^19.3.0-alpha.85402254",
"jest-validate": "^19.3.0-alpha.85402254",
"pretty-format": "^19.3.0-alpha.85402254"
}
}
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