jest-worker
Advanced tools
Comparing version 24.0.0-alpha.12 to 24.0.0-alpha.13
@@ -34,2 +34,34 @@ /** | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function getExposedMethods(workerPath, options) { | ||
@@ -81,4 +113,5 @@ let exposedMethods = options.exposedMethods; // If no methods list is given, try getting it by auto-requiring the module. | ||
constructor(workerPath, options) { | ||
this._options = Object.assign({}, options); | ||
this._options = _objectSpread({}, options); | ||
const workerPoolOptions = { | ||
disableWorkerThreads: this._options.disableWorkerThreads || false, | ||
forkOptions: this._options.forkOptions || {}, | ||
@@ -115,3 +148,3 @@ maxRetries: this._options.maxRetries || 3, | ||
}); | ||
} // eslint-disable-next-line no-unclear-flowtypes | ||
} | ||
@@ -118,0 +151,0 @@ _callFunctionWithArgs(method, ...args) { |
@@ -13,4 +13,2 @@ /** | ||
/* eslint-disable no-unclear-flowtypes */ | ||
Object.defineProperty(exports, '__esModule', { | ||
@@ -17,0 +15,0 @@ value: true |
@@ -41,3 +41,3 @@ /** | ||
if (canUseWorkerThreads()) { | ||
if (!this._options.disableWorkerThreads && canUseWorkerThreads()) { | ||
Worker = require('./workers/NodeThreadsWorker').default; | ||
@@ -44,0 +44,0 @@ } else { |
@@ -42,2 +42,34 @@ /** | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -75,7 +107,7 @@ * This class wraps the child process and provides a nice interface to | ||
const child = _child_process().default.fork( | ||
require.resolve('./processChild'), // $FlowFixMe: Flow does not work well with Object.assign. | ||
Object.assign( | ||
require.resolve('./processChild'), | ||
_objectSpread( | ||
{ | ||
cwd: process.cwd(), | ||
env: Object.assign( | ||
env: _objectSpread( | ||
{}, | ||
@@ -97,4 +129,3 @@ process.env, | ||
child.on('message', this.onMessage.bind(this)); | ||
child.on('exit', this.onExit.bind(this)); // $FlowFixMe: wrong "ChildProcess.send" signature. | ||
child.on('exit', this.onExit.bind(this)); | ||
child.send([ | ||
@@ -183,3 +214,3 @@ _types.CHILD_MESSAGE_INITIALIZE, | ||
this._onProcessEnd = onProcessEnd; | ||
this._retries = 0; // $FlowFixMe | ||
this._retries = 0; | ||
@@ -186,0 +217,0 @@ this._child.send(request); |
@@ -32,2 +32,34 @@ /** | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
// $FlowFixMe: Flow doesn't know about experimental features of Node | ||
@@ -50,7 +82,6 @@ const _require = require('worker_threads'), | ||
stdout: true, | ||
// $FlowFixMe: Flow does not work well with Object.assign. | ||
workerData: Object.assign( | ||
workerData: _objectSpread( | ||
{ | ||
cwd: process.cwd(), | ||
env: Object.assign({}, process.env, { | ||
env: _objectSpread({}, process.env, { | ||
JEST_WORKER_ID: this._options.workerId | ||
@@ -57,0 +88,0 @@ }), |
@@ -13,2 +13,34 @@ /** | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
let file = null; | ||
@@ -85,3 +117,3 @@ let setupArgs = []; | ||
error.stack, // $FlowFixMe: this is safe to just inherit from Object. | ||
typeof error === 'object' ? Object.assign({}, error) : error | ||
typeof error === 'object' ? _objectSpread({}, error) : error | ||
]); | ||
@@ -88,0 +120,0 @@ } |
@@ -23,2 +23,34 @@ /** | ||
function _objectSpread(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat( | ||
Object.getOwnPropertySymbols(source).filter(function(sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
}) | ||
); | ||
} | ||
ownKeys.forEach(function(key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
let file = null; | ||
@@ -99,3 +131,3 @@ let setupArgs = []; | ||
error.stack, // $FlowFixMe: this is safe to just inherit from Object. | ||
typeof error === 'object' ? Object.assign({}, error) : error | ||
typeof error === 'object' ? _objectSpread({}, error) : error | ||
]); | ||
@@ -102,0 +134,0 @@ } |
{ | ||
"name": "jest-worker", | ||
"version": "24.0.0-alpha.12", | ||
"version": "24.0.0-alpha.13", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/facebook/jest.git" | ||
"url": "https://github.com/facebook/jest.git", | ||
"directory": "packages/jest-worker" | ||
}, | ||
@@ -12,8 +13,11 @@ "license": "MIT", | ||
"merge-stream": "^1.0.1", | ||
"supports-color": "^5.5.0" | ||
"supports-color": "^6.1.0" | ||
}, | ||
"devDependencies": { | ||
"worker-farm": "^1.6.0" | ||
}, | ||
"engines": { | ||
"node": ">= 6" | ||
}, | ||
"gitHead": "4f2bcb861d1f0fb150c05970362e52a38c31f67e" | ||
"gitHead": "6de22dde9a10f775adc7b6f80080bdd224f6ae31" | ||
} |
@@ -48,2 +48,4 @@ # jest-worker | ||
You can explicitly opt-out of this by passing `disableWorkerThreads: true`. | ||
## API | ||
@@ -93,2 +95,6 @@ | ||
#### `disableWorkerThreads: boolean` (optional) | ||
`jest-worker` will automatically detect if `worker_threads` are available and use them. However, running under threads comes with [some caveats](https://nodejs.org/api/worker_threads.html#worker_threads_class_worker), and is still experimental, so you can `opt-out` of this and use `disableWorkerThreads: true`. | ||
## Worker | ||
@@ -95,0 +101,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
43107
0
100
1096
218
1
+ Addedsupports-color@6.1.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedsupports-color@^6.1.0