2021-06-07 02:09:53 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright Microsoft Corporation. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-02-03 01:46:54 +01:00
|
|
|
import { serializeCompilationCache } from './compilationCache';
|
2023-01-27 21:44:15 +01:00
|
|
|
import type { FullConfigInternal, TestInfoError, TestStatus } from './types';
|
2021-06-07 02:09:53 +02:00
|
|
|
|
2023-01-27 02:26:47 +01:00
|
|
|
export type ConfigCLIOverrides = {
|
|
|
|
|
forbidOnly?: boolean;
|
|
|
|
|
fullyParallel?: boolean;
|
|
|
|
|
globalTimeout?: number;
|
|
|
|
|
maxFailures?: number;
|
|
|
|
|
outputDir?: string;
|
|
|
|
|
quiet?: boolean;
|
|
|
|
|
repeatEach?: number;
|
|
|
|
|
retries?: number;
|
|
|
|
|
reporter?: string;
|
|
|
|
|
shard?: { current: number, total: number };
|
|
|
|
|
timeout?: number;
|
|
|
|
|
ignoreSnapshots?: boolean;
|
|
|
|
|
updateSnapshots?: 'all'|'none'|'missing';
|
|
|
|
|
workers?: number;
|
|
|
|
|
projects?: { name: string, use?: any }[],
|
|
|
|
|
use?: any;
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-20 00:56:57 +01:00
|
|
|
export type SerializedConfig = {
|
2022-04-30 01:05:08 +02:00
|
|
|
configFile: string | undefined;
|
|
|
|
|
configDir: string;
|
2022-05-03 23:25:56 +02:00
|
|
|
configCLIOverrides: ConfigCLIOverrides;
|
2023-02-03 01:46:54 +01:00
|
|
|
compilationCache: any;
|
2021-06-07 02:09:53 +02:00
|
|
|
};
|
2022-04-30 01:05:08 +02:00
|
|
|
|
2022-07-12 23:47:14 +02:00
|
|
|
export type TtyParams = {
|
2022-07-08 02:56:41 +02:00
|
|
|
rows: number | undefined;
|
|
|
|
|
columns: number | undefined;
|
2022-07-12 23:47:14 +02:00
|
|
|
colorDepth: number;
|
2022-07-08 02:56:41 +02:00
|
|
|
};
|
|
|
|
|
|
2023-01-17 21:43:51 +01:00
|
|
|
export type ProcessInitParams = {
|
|
|
|
|
stdoutParams: TtyParams;
|
|
|
|
|
stderrParams: TtyParams;
|
2023-01-17 23:53:11 +01:00
|
|
|
processName: string;
|
2023-01-17 21:43:51 +01:00
|
|
|
};
|
|
|
|
|
|
2021-06-07 02:09:53 +02:00
|
|
|
export type WorkerInitParams = {
|
|
|
|
|
workerIndex: number;
|
2021-11-01 18:37:34 +01:00
|
|
|
parallelIndex: number;
|
2021-06-07 02:09:53 +02:00
|
|
|
repeatEachIndex: number;
|
2022-07-28 05:17:19 +02:00
|
|
|
projectId: string;
|
2023-01-20 00:56:57 +01:00
|
|
|
config: SerializedConfig;
|
2021-06-07 02:09:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TestBeginPayload = {
|
|
|
|
|
testId: string;
|
2021-07-19 02:40:59 +02:00
|
|
|
startWallTime: number; // milliseconds since unix epoch
|
2021-06-07 02:09:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TestEndPayload = {
|
|
|
|
|
testId: string;
|
|
|
|
|
duration: number;
|
|
|
|
|
status: TestStatus;
|
2022-12-21 18:36:59 +01:00
|
|
|
errors: TestInfoError[];
|
2021-06-07 02:09:53 +02:00
|
|
|
expectedStatus: TestStatus;
|
|
|
|
|
annotations: { type: string, description?: string }[];
|
|
|
|
|
timeout: number;
|
2021-07-16 22:48:37 +02:00
|
|
|
attachments: { name: string, path?: string, body?: string, contentType: string }[];
|
2021-06-07 02:09:53 +02:00
|
|
|
};
|
|
|
|
|
|
2021-08-03 02:17:20 +02:00
|
|
|
export type StepBeginPayload = {
|
2021-07-31 01:07:02 +02:00
|
|
|
testId: string;
|
2021-08-03 02:17:20 +02:00
|
|
|
stepId: string;
|
2023-03-31 06:05:07 +02:00
|
|
|
parentStepId: string | undefined;
|
2021-08-03 02:17:20 +02:00
|
|
|
title: string;
|
|
|
|
|
category: string;
|
|
|
|
|
wallTime: number; // milliseconds since unix epoch
|
2021-10-19 06:06:18 +02:00
|
|
|
location?: { file: string, line: number, column: number };
|
2021-08-03 02:17:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type StepEndPayload = {
|
|
|
|
|
testId: string;
|
|
|
|
|
stepId: string;
|
2022-03-31 06:52:00 +02:00
|
|
|
refinedTitle?: string;
|
2021-08-03 02:17:20 +02:00
|
|
|
wallTime: number; // milliseconds since unix epoch
|
2022-12-21 18:36:59 +01:00
|
|
|
error?: TestInfoError;
|
2021-07-31 01:07:02 +02:00
|
|
|
};
|
|
|
|
|
|
2021-06-07 02:09:53 +02:00
|
|
|
export type TestEntry = {
|
|
|
|
|
testId: string;
|
|
|
|
|
retry: number;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type RunPayload = {
|
|
|
|
|
file: string;
|
|
|
|
|
entries: TestEntry[];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type DonePayload = {
|
2022-12-21 18:36:59 +01:00
|
|
|
fatalErrors: TestInfoError[];
|
2022-03-09 05:29:31 +01:00
|
|
|
skipTestsDueToSetupFailure: string[]; // test ids
|
2022-04-25 18:05:40 +02:00
|
|
|
fatalUnknownTestIds?: string[];
|
2021-06-07 02:09:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type TestOutputPayload = {
|
|
|
|
|
text?: string;
|
|
|
|
|
buffer?: string;
|
|
|
|
|
};
|
2022-02-23 21:32:12 +01:00
|
|
|
|
|
|
|
|
export type TeardownErrorsPayload = {
|
2022-12-21 18:36:59 +01:00
|
|
|
fatalErrors: TestInfoError[];
|
2022-02-23 21:32:12 +01:00
|
|
|
};
|
2023-01-27 21:44:15 +01:00
|
|
|
|
2023-03-17 23:46:52 +01:00
|
|
|
export type EnvProducedPayload = [string, string | null][];
|
|
|
|
|
|
2023-01-27 21:44:15 +01:00
|
|
|
export function serializeConfig(config: FullConfigInternal): SerializedConfig {
|
|
|
|
|
const result: SerializedConfig = {
|
|
|
|
|
configFile: config.configFile,
|
2023-02-02 00:25:26 +01:00
|
|
|
configDir: config._internal.configDir,
|
|
|
|
|
configCLIOverrides: config._internal.configCLIOverrides,
|
2023-02-03 01:46:54 +01:00
|
|
|
compilationCache: serializeCompilationCache(),
|
2023-01-27 21:44:15 +01:00
|
|
|
};
|
|
|
|
|
return result;
|
|
|
|
|
}
|