Socket
Socket
Sign inDemoInstall

jest-worker

Package Overview
Dependencies
Maintainers
2
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-worker - npm Package Compare versions

Comparing version 23.0.0-alpha.2 to 23.0.0-alpha.4

21

build/child.js

@@ -7,3 +7,3 @@ /**

*
*
*
*/

@@ -16,3 +16,3 @@

function _load_types() {
return _types = require('./types');
return (_types = require('./types'));
}

@@ -50,3 +50,5 @@

default:
throw new TypeError('Unexpected request from parent process: ' + request[0]);
throw new TypeError(
'Unexpected request from parent process: ' + request[0]
);
}

@@ -72,5 +74,10 @@ });

process.send([(_types || _load_types()).PARENT_MESSAGE_ERROR, error.constructor && error.constructor.name, error.message, error.stack,
// $FlowFixMe: this is safe to just inherit from Object.
typeof error === 'object' ? Object.assign({}, error) : error]);
process.send([
(_types || _load_types()).PARENT_MESSAGE_ERROR,
error.constructor && error.constructor.name,
error.message,
error.stack,
// $FlowFixMe: this is safe to just inherit from Object.
typeof error === 'object' ? Object.assign({}, error) : error
]);
}

@@ -99,2 +106,2 @@

}
}
}

@@ -7,3 +7,3 @@ /**

*
*
*
*/

@@ -13,3 +13,3 @@

Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true

@@ -21,3 +21,3 @@ });

function _load_mergeStream() {
return _mergeStream = _interopRequireDefault(require('merge-stream'));
return (_mergeStream = _interopRequireDefault(require('merge-stream')));
}

@@ -28,3 +28,3 @@

function _load_os() {
return _os = _interopRequireDefault(require('os'));
return (_os = _interopRequireDefault(require('os')));
}

@@ -35,3 +35,3 @@

function _load_path() {
return _path = _interopRequireDefault(require('path'));
return (_path = _interopRequireDefault(require('path')));
}

@@ -42,3 +42,3 @@

function _load_types() {
return _types = require('./types');
return (_types = require('./types'));
}

@@ -49,6 +49,8 @@

function _load_worker() {
return _worker = _interopRequireDefault(require('./worker'));
return (_worker = _interopRequireDefault(require('./worker')));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

@@ -84,7 +86,8 @@ /* istanbul ignore next */

exports.default = class {
constructor(workerPath) {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
let options =
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
const numWorkers = options.numWorkers || (_os || _load_os()).default.cpus().length - 1;
const numWorkers =
options.numWorkers || (_os || _load_os()).default.cpus().length - 1;
const workers = new Array(numWorkers);

@@ -130,3 +133,5 @@ const stdout = (0, (_mergeStream || _load_mergeStream()).default)();

exposedMethods = Object.keys(child).filter(name => typeof child[name] === 'function');
exposedMethods = Object.keys(child).filter(
name => typeof child[name] === 'function'
);

@@ -178,3 +183,6 @@ if (typeof child === 'function') {

for (let i = 0; i < workers.length; i++) {
workers[i].send([(_types || _load_types()).CHILD_MESSAGE_END, false], emptyMethod);
workers[i].send(
[(_types || _load_types()).CHILD_MESSAGE_END, false],
emptyMethod
);
}

@@ -187,3 +195,9 @@

_makeCall(method) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
for (
var _len = arguments.length,
args = Array(_len > 1 ? _len - 1 : 0),
_key = 1;
_key < _len;
_key++
) {
args[_key - 1] = arguments[_key];

@@ -202,3 +216,8 @@ }

const cacheKeys = this._cacheKeys;
const request = [(_types || _load_types()).CHILD_MESSAGE_CALL, false, method, args];
const request = [
(_types || _load_types()).CHILD_MESSAGE_CALL,
false,
method,
args
];

@@ -241,2 +260,2 @@ let worker = null;

}
};
};

@@ -7,3 +7,3 @@ /**

*
*
*
*/

@@ -19,11 +19,11 @@

Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true
});
const CHILD_MESSAGE_INITIALIZE = exports.CHILD_MESSAGE_INITIALIZE = 0;
const CHILD_MESSAGE_CALL = exports.CHILD_MESSAGE_CALL = 1;
const CHILD_MESSAGE_END = exports.CHILD_MESSAGE_END = 2;
const CHILD_MESSAGE_INITIALIZE = (exports.CHILD_MESSAGE_INITIALIZE = 0);
const CHILD_MESSAGE_CALL = (exports.CHILD_MESSAGE_CALL = 1);
const CHILD_MESSAGE_END = (exports.CHILD_MESSAGE_END = 2);
const PARENT_MESSAGE_OK = exports.PARENT_MESSAGE_OK = 0;
const PARENT_MESSAGE_ERROR = exports.PARENT_MESSAGE_ERROR = 1;
const PARENT_MESSAGE_OK = (exports.PARENT_MESSAGE_OK = 0);
const PARENT_MESSAGE_ERROR = (exports.PARENT_MESSAGE_ERROR = 1);

@@ -36,2 +36,2 @@ // Option objects.

// Queue types.
// Queue types.

@@ -7,3 +7,3 @@ /**

*
*
*
*/

@@ -13,3 +13,3 @@

Object.defineProperty(exports, "__esModule", {
Object.defineProperty(exports, '__esModule', {
value: true

@@ -21,3 +21,3 @@ });

function _load_child_process() {
return _child_process = _interopRequireDefault(require('child_process'));
return (_child_process = _interopRequireDefault(require('child_process')));
}

@@ -28,6 +28,8 @@

function _load_types() {
return _types = require('./types');
return (_types = require('./types'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {default: obj};
}

@@ -53,3 +55,2 @@ /**

exports.default = class {
constructor(options) {

@@ -71,3 +72,3 @@ this._options = options;

send(request, callback) {
const item = { callback, next: null, request };
const item = {callback, next: null, request};

@@ -85,13 +86,18 @@ if (this._last) {

_initialize() {
const child = (_child_process || _load_child_process()).default.fork(require.resolve('./child'),
// $FlowFixMe: Flow does not work well with Object.assign.
Object.assign({
cwd: process.cwd(),
env: Object.assign({}, process.env, {
JEST_WORKER_ID: this._options.workerId
}),
// Suppress --debug / --inspect flags while preserving others (like --harmony).
execArgv: process.execArgv.filter(v => !/^--(debug|inspect)/.test(v)),
silent: true
}, this._options.forkOptions));
const child = (_child_process || _load_child_process()).default.fork(
require.resolve('./child'),
// $FlowFixMe: Flow does not work well with Object.assign.
Object.assign(
{
cwd: process.cwd(),
env: Object.assign({}, process.env, {
JEST_WORKER_ID: this._options.workerId
}),
// Suppress --debug / --inspect flags while preserving others (like --harmony).
execArgv: process.execArgv.filter(v => !/^--(debug|inspect)/.test(v)),
silent: true
},
this._options.forkOptions
)
);

@@ -102,3 +108,7 @@ child.on('message', this._receive.bind(this));

// $FlowFixMe: wrong "ChildProcess.send" signature.
child.send([(_types || _load_types()).CHILD_MESSAGE_INITIALIZE, false, this._options.workerPath]);
child.send([
(_types || _load_types()).CHILD_MESSAGE_INITIALIZE,
false,
this._options.workerPath
]);

@@ -115,3 +125,9 @@ this._retries++;

this._receive([(_types || _load_types()).PARENT_MESSAGE_ERROR, error.name, error.message, error.stack, { type: 'WorkerError' }]);
this._receive([
(_types || _load_types()).PARENT_MESSAGE_ERROR,
error.name,
error.message,
error.stack,
{type: 'WorkerError'}
]);
}

@@ -199,2 +215,2 @@ }

}
};
};
{
"name": "jest-worker",
"version": "23.0.0-alpha.2",
"version": "23.0.0-alpha.4",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

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