UNPKG

1.96 kBTypeScriptView Raw
1import { FileDescriptions, StrykerOptions } from '@stryker-mutator/api/core';
2import { LoggingClientContext } from '../logging/index.js';
3export declare enum WorkerMessageKind {
4 Init = 0,
5 Call = 1,
6 Dispose = 2
7}
8export declare enum ParentMessageKind {
9 /**
10 * Indicates that the child process is spawned and ready to receive messages
11 */
12 Ready = 0,
13 /**
14 * Indicates that initialization is done
15 */
16 Initialized = 1,
17 /**
18 * Indicates an error happened during initialization
19 */
20 InitError = 2,
21 /**
22 * Indicates that a 'Call' was successful
23 */
24 CallResult = 3,
25 /**
26 * Indicates that a 'Call' was rejected
27 */
28 CallRejection = 4,
29 /**
30 * Indicates that a 'Dispose' was completed
31 */
32 DisposeCompleted = 5
33}
34export type WorkerMessage = CallMessage | DisposeMessage | InitMessage;
35export type ParentMessage = InitRejectionResult | RejectionResult | WorkResult | {
36 kind: ParentMessageKind.DisposeCompleted | ParentMessageKind.Initialized | ParentMessageKind.Ready;
37};
38export interface InitMessage {
39 kind: WorkerMessageKind.Init;
40 loggingContext: LoggingClientContext;
41 options: StrykerOptions;
42 fileDescriptions: FileDescriptions;
43 pluginModulePaths: readonly string[];
44 workingDirectory: string;
45 namedExport: string;
46 modulePath: string;
47}
48export interface DisposeMessage {
49 kind: WorkerMessageKind.Dispose;
50}
51export interface WorkResult {
52 kind: ParentMessageKind.CallResult;
53 correlationId: number;
54 result: any;
55}
56export interface RejectionResult {
57 kind: ParentMessageKind.CallRejection;
58 correlationId: number;
59 error: string;
60}
61export interface InitRejectionResult {
62 kind: ParentMessageKind.InitError;
63 error: string;
64}
65export interface CallMessage {
66 correlationId: number;
67 kind: WorkerMessageKind.Call;
68 args: any[];
69 methodName: string;
70}
71//# sourceMappingURL=message-protocol.d.ts.map
\No newline at end of file