source: trip-planner-front/node_modules/jest-worker/build/index.d.ts@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7/// <reference types="node" />
8import type { FarmOptions, PoolExitResult, PromiseWithCustomMessage, TaskQueue } from './types';
9export { default as PriorityQueue } from './PriorityQueue';
10export { default as FifoQueue } from './FifoQueue';
11export { default as messageParent } from './workers/messageParent';
12/**
13 * The Jest farm (publicly called "Worker") is a class that allows you to queue
14 * methods across multiple child processes, in order to parallelize work. This
15 * is done by providing an absolute path to a module that will be loaded on each
16 * of the child processes, and bridged to the main process.
17 *
18 * Bridged methods are specified by using the "exposedMethods" property of the
19 * "options" object. This is an array of strings, where each of them corresponds
20 * to the exported name in the loaded module.
21 *
22 * You can also control the amount of workers by using the "numWorkers" property
23 * of the "options" object, and the settings passed to fork the process through
24 * the "forkOptions" property. The amount of workers defaults to the amount of
25 * CPUS minus one.
26 *
27 * Queueing calls can be done in two ways:
28 * - Standard method: calls will be redirected to the first available worker,
29 * so they will get executed as soon as they can.
30 *
31 * - Sticky method: if a "computeWorkerKey" method is provided within the
32 * config, the resulting string of this method will be used as a key.
33 * Every time this key is returned, it is guaranteed that your job will be
34 * processed by the same worker. This is specially useful if your workers
35 * are caching results.
36 */
37export declare class Worker {
38 private _ending;
39 private _farm;
40 private _options;
41 private _workerPool;
42 constructor(workerPath: string, options?: FarmOptions);
43 private _bindExposedWorkerMethods;
44 private _callFunctionWithArgs;
45 getStderr(): NodeJS.ReadableStream;
46 getStdout(): NodeJS.ReadableStream;
47 end(): Promise<PoolExitResult>;
48}
49export type { PromiseWithCustomMessage, TaskQueue };
Note: See TracBrowser for help on using the repository browser.