-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Description
The cache for making workers of jest-worker sticky to a worker using computeWorkerKey seems to only be set in the callback (code). In this example, even though computeWorkerKey is a function returning a constant, multiple workers are created.
This seems unintended?
const Worker = require('jest-worker').default;
async function main() {
const myWorker = new Worker(require.resolve('./worker'), {
computeWorkerKey: (method, ...args) => 'constant',
});
const workItems = new Set(['foo', 'bar', 'baz']);
for (const workItem of workItems) {
console.log('start', workItem);
myWorker.transform('/tmp/foo.js').then(res => {
console.log('done', workItem);
})
}
myWorker.end();
}
main().then(undefined, err => {
console.log(err);
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels