@decaf-ts/utils 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/cjs/cli/commands/build-scripts.cjs +30 -3
- package/lib/cjs/cli/commands/build-scripts.cjs.map +1 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/esm/cli/commands/build-scripts.js +30 -3
- package/lib/esm/cli/commands/build-scripts.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/types/cli/commands/build-scripts.d.cts +1 -0
- package/lib/types/cli/commands/build-scripts.d.mts +1 -0
- package/lib/types/cli/index.d.cts +1 -1
- package/lib/types/cli/index.d.mts +1 -1
- package/lib/types/index.d.cts +7 -7
- package/lib/types/index.d.mts +7 -7
- package/lib/types/tests/utils.d.cts +1 -1
- package/lib/types/tests/utils.d.mts +1 -1
- package/package.json +1 -1
- package/lib/types/assets/slogans.d.ts +0 -19
- package/lib/types/bin/build-scripts.d.ts +0 -1
- package/lib/types/bin/release-chain-dispatch.d.ts +0 -1
- package/lib/types/bin/release-chain.d.ts +0 -1
- package/lib/types/bin/tag-release.d.ts +0 -1
- package/lib/types/cli/command.d.ts +0 -104
- package/lib/types/cli/commands/build-scripts.d.ts +0 -148
- package/lib/types/cli/commands/index.d.ts +0 -3
- package/lib/types/cli/commands/release-chain.d.ts +0 -62
- package/lib/types/cli/commands/tag-release.d.ts +0 -105
- package/lib/types/cli/constants.d.ts +0 -75
- package/lib/types/cli/index.d.ts +0 -4
- package/lib/types/cli/types.d.ts +0 -30
- package/lib/types/index.d.ts +0 -38
- package/lib/types/input/index.d.ts +0 -2
- package/lib/types/input/input.d.ts +0 -517
- package/lib/types/input/types.d.ts +0 -159
- package/lib/types/output/common.d.ts +0 -53
- package/lib/types/output/index.d.ts +0 -1
- package/lib/types/release-chain/index.d.ts +0 -43
- package/lib/types/tests/Consumer.d.ts +0 -151
- package/lib/types/tests/ProducerChildProcess.d.ts +0 -18
- package/lib/types/tests/TestReporter.d.ts +0 -245
- package/lib/types/tests/index.d.ts +0 -4
- package/lib/types/tests/jestPerformanceRunner.d.ts +0 -37
- package/lib/types/tests/utils.d.ts +0 -5
- package/lib/types/utils/constants.d.ts +0 -65
- package/lib/types/utils/fs.d.ts +0 -259
- package/lib/types/utils/http.d.ts +0 -41
- package/lib/types/utils/index.d.ts +0 -6
- package/lib/types/utils/md.d.ts +0 -156
- package/lib/types/utils/performanceRunner.d.ts +0 -129
- package/lib/types/utils/timeout.d.ts +0 -12
- package/lib/types/utils/types.d.ts +0 -112
- package/lib/types/utils/utils.d.ts +0 -133
- package/lib/types/writers/OutputWriter.d.ts +0 -49
- package/lib/types/writers/RegexpOutputWriter.d.ts +0 -110
- package/lib/types/writers/StandardOutputWriter.d.ts +0 -130
- package/lib/types/writers/index.d.ts +0 -4
- package/lib/types/writers/types.d.ts +0 -29
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Logger } from "@decaf-ts/logging";
|
|
2
|
-
/**
|
|
3
|
-
* @description Prints a styled banner to the console.
|
|
4
|
-
* @summary Generates and prints a colorful ASCII art banner with a random slogan.
|
|
5
|
-
* @param {Logger} [logger] - Optional logger for verbose output.
|
|
6
|
-
* @memberOf module:utils
|
|
7
|
-
* @function printBanner
|
|
8
|
-
* @mermaid
|
|
9
|
-
* sequenceDiagram
|
|
10
|
-
* participant printBanner
|
|
11
|
-
* participant getSlogan
|
|
12
|
-
* participant padEnd
|
|
13
|
-
* participant console
|
|
14
|
-
* printBanner->>getSlogan: Call getSlogan()
|
|
15
|
-
* getSlogan-->>printBanner: Return random slogan
|
|
16
|
-
* printBanner->>printBanner: Create banner ASCII art
|
|
17
|
-
* printBanner->>printBanner: Split banner into lines
|
|
18
|
-
* printBanner->>printBanner: Calculate max line length
|
|
19
|
-
* printBanner->>padEnd: Call padEnd with slogan
|
|
20
|
-
* padEnd-->>printBanner: Return padded slogan line
|
|
21
|
-
* loop For each banner line
|
|
22
|
-
* printBanner->>style: Call style(line)
|
|
23
|
-
* style-->>printBanner: Return styled line
|
|
24
|
-
* printBanner->>console: Log styled line
|
|
25
|
-
* end
|
|
26
|
-
*/
|
|
27
|
-
export declare function printBanner(logger?: Logger): void;
|
|
28
|
-
/**
|
|
29
|
-
* @description Retrieves a slogan from the predefined list.
|
|
30
|
-
* @summary Fetches a random slogan or a specific one by index from the slogans list.
|
|
31
|
-
* @param {number} [i] - Optional index to retrieve a specific slogan.
|
|
32
|
-
* @return {string} The selected slogan.
|
|
33
|
-
* @function getSlogan
|
|
34
|
-
* @memberOf module:utils
|
|
35
|
-
* @mermaid
|
|
36
|
-
* sequenceDiagram
|
|
37
|
-
* participant getSlogan
|
|
38
|
-
* participant Math.random
|
|
39
|
-
* participant slogans
|
|
40
|
-
* alt i is undefined
|
|
41
|
-
* getSlogan->>Math.random: Generate random index
|
|
42
|
-
* Math.random-->>getSlogan: Return random index
|
|
43
|
-
* else i is defined
|
|
44
|
-
* Note over getSlogan: Use provided index
|
|
45
|
-
* end
|
|
46
|
-
* getSlogan->>slogans: Access slogan at index
|
|
47
|
-
* slogans-->>getSlogan: Return slogan
|
|
48
|
-
* alt Error occurs
|
|
49
|
-
* getSlogan->>getSlogan: Throw error
|
|
50
|
-
* end
|
|
51
|
-
* getSlogan-->>Caller: Return slogan
|
|
52
|
-
*/
|
|
53
|
-
export declare function getSlogan(i?: number): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./common";
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface ReleaseChainOptions {
|
|
2
|
-
metaRepoUrl: string;
|
|
3
|
-
branch: string;
|
|
4
|
-
currentRepo?: string;
|
|
5
|
-
packageName: string;
|
|
6
|
-
workspace?: string;
|
|
7
|
-
token?: string;
|
|
8
|
-
submoduleFile?: string;
|
|
9
|
-
submodulePath?: string;
|
|
10
|
-
targetBaseBranch?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ReleaseChainDispatchOptions {
|
|
13
|
-
metaRepoUrl: string;
|
|
14
|
-
branch: string;
|
|
15
|
-
workflowFile?: string;
|
|
16
|
-
repoSlug?: string;
|
|
17
|
-
currentRepo?: string;
|
|
18
|
-
token?: string;
|
|
19
|
-
ref?: string;
|
|
20
|
-
targetBaseBranch?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare class ReleaseChainRunner {
|
|
23
|
-
private readonly options;
|
|
24
|
-
private readonly workspace;
|
|
25
|
-
private readonly clonesRoot;
|
|
26
|
-
private readonly token?;
|
|
27
|
-
private readonly metaRepoSlug;
|
|
28
|
-
private readonly currentRepo?;
|
|
29
|
-
constructor(options: ReleaseChainOptions);
|
|
30
|
-
run(): Promise<void>;
|
|
31
|
-
private evaluateModule;
|
|
32
|
-
private cloneRepository;
|
|
33
|
-
private checkoutTargetBranch;
|
|
34
|
-
private loadSubmodules;
|
|
35
|
-
private runCommand;
|
|
36
|
-
private githubRequest;
|
|
37
|
-
private findExistingPr;
|
|
38
|
-
private acceptPullRequest;
|
|
39
|
-
private createPullRequest;
|
|
40
|
-
private getDefaultBranch;
|
|
41
|
-
}
|
|
42
|
-
export declare function runReleaseChain(options: ReleaseChainOptions): Promise<void>;
|
|
43
|
-
export declare function dispatchReleaseChainWorkflow(options: ReleaseChainDispatchOptions): Promise<void>;
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { LoggedClass } from "@decaf-ts/logging";
|
|
2
|
-
import { TestReporter } from "./TestReporter";
|
|
3
|
-
/**
|
|
4
|
-
* @description Store for logs indexed by identifier.
|
|
5
|
-
* @summary A record where keys are identifiers and values are arrays of log strings.
|
|
6
|
-
* @typedef {Record<number, string[]>} LogStore
|
|
7
|
-
* @memberOf module:utils
|
|
8
|
-
*/
|
|
9
|
-
type LogStore = Record<number, string[]>;
|
|
10
|
-
/**
|
|
11
|
-
* @description Structure of a parsed log entry.
|
|
12
|
-
* @summary Contains timestamp, child identifier, and action.
|
|
13
|
-
* @interface ParsedLog
|
|
14
|
-
* @property {number} timestamp - The timestamp of the log.
|
|
15
|
-
* @property {string} child - The child identifier.
|
|
16
|
-
* @property {string} action - The action performed.
|
|
17
|
-
* @memberOf module:utils
|
|
18
|
-
*/
|
|
19
|
-
export interface ParsedLog {
|
|
20
|
-
timestamp: number;
|
|
21
|
-
child: string;
|
|
22
|
-
action: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @description Result of a comparison between consumer and producer logs.
|
|
26
|
-
* @summary Contains arrays of parsed logs for both consumer and producer.
|
|
27
|
-
* @interface ComparerResult
|
|
28
|
-
* @property {ParsedLog[]} consumer - The parsed consumer logs.
|
|
29
|
-
* @property {ParsedLog[]} producer - The parsed producer logs.
|
|
30
|
-
* @memberOf module:utils
|
|
31
|
-
*/
|
|
32
|
-
export interface ComparerResult {
|
|
33
|
-
consumer: ParsedLog[];
|
|
34
|
-
producer: ParsedLog[];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @description Function type for comparing consumer and producer data.
|
|
38
|
-
* @summary Compares two LogStores and returns a Promise resolving to ComparerResult.
|
|
39
|
-
* @typedef {function(LogStore, LogStore): Promise<ComparerResult>} Comparer
|
|
40
|
-
* @memberOf module:utils
|
|
41
|
-
*/
|
|
42
|
-
type Comparer = (consumerData: LogStore, producerData: LogStore) => Promise<ComparerResult>;
|
|
43
|
-
/**
|
|
44
|
-
* @description Function type for handling consumer actions.
|
|
45
|
-
* @summary A function that takes an identifier and optional arguments, returning a result.
|
|
46
|
-
* @typedef {function(number, ...unknown[]): unknown | Promise<unknown>} ConsumerHandler
|
|
47
|
-
* @memberOf module:utils
|
|
48
|
-
*/
|
|
49
|
-
type ConsumerHandler = (identifier: number, ...args: unknown[]) => unknown | Promise<unknown>;
|
|
50
|
-
/**
|
|
51
|
-
* @description Default comparer function for consumer and producer logs.
|
|
52
|
-
* @summary Sorts and compares consumer and producer logs to ensure they match.
|
|
53
|
-
* @param {LogStore} consumerData - The consumer logs.
|
|
54
|
-
* @param {LogStore} producerData - The producer logs.
|
|
55
|
-
* @return {Promise<ComparerResult>} The comparison result.
|
|
56
|
-
* @function defaultComparer
|
|
57
|
-
* @memberOf module:utils
|
|
58
|
-
*/
|
|
59
|
-
export declare const defaultComparer: Comparer;
|
|
60
|
-
/**
|
|
61
|
-
* @description Options for the reporting comparer.
|
|
62
|
-
* @summary Configuration options for the reportingComparer function.
|
|
63
|
-
* @interface ReportingComparerOptions
|
|
64
|
-
* @property {TestReporter} [reporter] - The test reporter instance.
|
|
65
|
-
* @property {string} [testCase] - The test case name.
|
|
66
|
-
* @property {string} [referencePrefix] - The prefix for report references.
|
|
67
|
-
* @memberOf module:utils
|
|
68
|
-
*/
|
|
69
|
-
export interface ReportingComparerOptions {
|
|
70
|
-
reporter?: TestReporter;
|
|
71
|
-
testCase?: string;
|
|
72
|
-
referencePrefix?: string;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @description Comparer function that reports results using TestReporter.
|
|
76
|
-
* @summary Compares logs and generates a report with tables and messages.
|
|
77
|
-
* @param {LogStore} consumerData - The consumer logs.
|
|
78
|
-
* @param {LogStore} producerData - The producer logs.
|
|
79
|
-
* @param {ReportingComparerOptions} [options] - Options for reporting.
|
|
80
|
-
* @return {Promise<ComparerResult>} The comparison result.
|
|
81
|
-
* @function reportingComparer
|
|
82
|
-
* @memberOf module:utils
|
|
83
|
-
*/
|
|
84
|
-
export declare const reportingComparer: (consumerData: LogStore, producerData: LogStore, options?: ReportingComparerOptions) => Promise<ComparerResult>;
|
|
85
|
-
/**
|
|
86
|
-
* @class ConsumerRunner
|
|
87
|
-
* @description Runs a consumer process and manages producer child processes.
|
|
88
|
-
* @summary Orchestrates the execution of consumer and producer processes, collects logs, and compares results.
|
|
89
|
-
* @param {string} action - The action name.
|
|
90
|
-
* @param {ConsumerHandler} consumerHandler - The handler function for the consumer.
|
|
91
|
-
* @param {Comparer} [compareHandler] - Optional custom comparer function.
|
|
92
|
-
* @memberOf module:utils
|
|
93
|
-
*/
|
|
94
|
-
export declare class ConsumerRunner extends LoggedClass {
|
|
95
|
-
private readonly action;
|
|
96
|
-
private readonly handler;
|
|
97
|
-
private readonly comparerHandle;
|
|
98
|
-
private forkedCache;
|
|
99
|
-
private consumerResults;
|
|
100
|
-
private producerResults;
|
|
101
|
-
private childExitPromises;
|
|
102
|
-
private completionTriggered;
|
|
103
|
-
private producerCompletion;
|
|
104
|
-
private consumerCompletion;
|
|
105
|
-
private expectedIterations;
|
|
106
|
-
private activeHandlers;
|
|
107
|
-
constructor(action: string, consumerHandler: ConsumerHandler, compareHandler?: Comparer);
|
|
108
|
-
private reset;
|
|
109
|
-
private waitForChildExit;
|
|
110
|
-
private store;
|
|
111
|
-
private recordConsumer;
|
|
112
|
-
private isProducerComplete;
|
|
113
|
-
private isConsumerComplete;
|
|
114
|
-
private terminateChildren;
|
|
115
|
-
/**
|
|
116
|
-
* @description Runs the consumer and producer processes.
|
|
117
|
-
* @summary Starts the producer child processes and the consumer handler, then waits for completion and compares results.
|
|
118
|
-
* @param {number} count - The number of producers.
|
|
119
|
-
* @param {number} [timeout] - The timeout for producers.
|
|
120
|
-
* @param {number} times - The number of times to repeat.
|
|
121
|
-
* @param {boolean} [random] - Whether to use random timeouts.
|
|
122
|
-
* @return {Promise<ComparerResult>} The comparison result.
|
|
123
|
-
* @mermaid
|
|
124
|
-
* sequenceDiagram
|
|
125
|
-
* participant Runner as ConsumerRunner
|
|
126
|
-
* participant Child as ProducerChild
|
|
127
|
-
* participant Handler as ConsumerHandler
|
|
128
|
-
* participant Comparer as Comparer
|
|
129
|
-
* Runner->>Runner: reset()
|
|
130
|
-
* loop For each count
|
|
131
|
-
* Runner->>Child: fork()
|
|
132
|
-
* Runner->>Runner: Store child process
|
|
133
|
-
* end
|
|
134
|
-
* Runner->>Child: send(start message)
|
|
135
|
-
* loop For each message from Child
|
|
136
|
-
* Child->>Runner: message(action)
|
|
137
|
-
* Runner->>Runner: store producer log
|
|
138
|
-
* Runner->>Handler: call handler
|
|
139
|
-
* Handler-->>Runner: return
|
|
140
|
-
* Runner->>Runner: record consumer log
|
|
141
|
-
* Runner->>Runner: finalizeIfComplete()
|
|
142
|
-
* end
|
|
143
|
-
* alt Complete
|
|
144
|
-
* Runner->>Comparer: compare logs
|
|
145
|
-
* Comparer-->>Runner: return result
|
|
146
|
-
* Runner-->>Caller: resolve(result)
|
|
147
|
-
* end
|
|
148
|
-
*/
|
|
149
|
-
run(count: number, timeout: number | undefined, times: number, random: boolean | undefined): Promise<ComparerResult>;
|
|
150
|
-
}
|
|
151
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type ParentMessage = {
|
|
2
|
-
identifier: number;
|
|
3
|
-
action: string;
|
|
4
|
-
timeout?: number;
|
|
5
|
-
times: number;
|
|
6
|
-
random?: boolean;
|
|
7
|
-
terminate?: boolean;
|
|
8
|
-
};
|
|
9
|
-
type ProducerResponse = {
|
|
10
|
-
identifier: number;
|
|
11
|
-
action: string;
|
|
12
|
-
timeout?: number;
|
|
13
|
-
times: number;
|
|
14
|
-
random?: boolean;
|
|
15
|
-
result?: string[];
|
|
16
|
-
};
|
|
17
|
-
declare let shuttingDown: boolean;
|
|
18
|
-
declare const completeAndExit: (logMessage?: string) => void;
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { MdTableDefinition } from "../utils/md";
|
|
2
|
-
/**
|
|
3
|
-
* @interface AddAttachParams
|
|
4
|
-
* @description Parameters for adding an attachment to a report
|
|
5
|
-
* @summary Interface for attachment parameters
|
|
6
|
-
* @memberOf module:utils
|
|
7
|
-
*/
|
|
8
|
-
export interface AddAttachParams {
|
|
9
|
-
attach: string | Buffer;
|
|
10
|
-
description: string | object;
|
|
11
|
-
context?: any;
|
|
12
|
-
bufferFormat?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @interface AddMsgParams
|
|
16
|
-
* @description Parameters for adding a message to a report
|
|
17
|
-
* @summary Interface for message parameters
|
|
18
|
-
* @memberOf module:utils
|
|
19
|
-
*/
|
|
20
|
-
export interface AddMsgParams {
|
|
21
|
-
message: string | object;
|
|
22
|
-
context?: any;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {("json"|"image"|"text"|"md")} PayloadType
|
|
26
|
-
* @description Types of payloads that can be handled
|
|
27
|
-
* @summary Union type for payload types
|
|
28
|
-
* @memberOf module:utils
|
|
29
|
-
*/
|
|
30
|
-
export type PayloadType = "json" | "image" | "text" | "md";
|
|
31
|
-
export type EvidenceData = {
|
|
32
|
-
name: string;
|
|
33
|
-
content: string | Buffer;
|
|
34
|
-
path: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* @description Environment variable key for Jest HTML reporters temporary directory path
|
|
38
|
-
* @summary Constant defining the environment variable key for Jest HTML reporters
|
|
39
|
-
* @const JestReportersTempPathEnvKey
|
|
40
|
-
* @memberOf module:utils
|
|
41
|
-
*/
|
|
42
|
-
export declare const JestReportersTempPathEnvKey = "JEST_HTML_REPORTERS_TEMP_DIR_PATH";
|
|
43
|
-
/**
|
|
44
|
-
* @description Environment variable key to enable file-based evidence storage
|
|
45
|
-
* @summary Constant defining the environment variable key for storage enablement
|
|
46
|
-
* @const TestReporterStorageEnabledEnvKey
|
|
47
|
-
* @memberOf module:utils
|
|
48
|
-
*/
|
|
49
|
-
export declare const TestReporterStorageEnabledEnvKey = "TEST_REPORTER_STORAGE_ENABLED";
|
|
50
|
-
/**
|
|
51
|
-
* @description Environment variable key for the base path of evidence storage
|
|
52
|
-
* @summary Constant defining the environment variable key for storage path
|
|
53
|
-
* @const TestReporterStoragePathEnvKey
|
|
54
|
-
* @memberOf module:utils
|
|
55
|
-
*/
|
|
56
|
-
export declare const TestReporterStoragePathEnvKey = "TEST_REPORTER_STORAGE_PATH";
|
|
57
|
-
/**
|
|
58
|
-
* @description Test reporting utility class for managing test results and evidence
|
|
59
|
-
* @summary A comprehensive test reporter that handles various types of test artifacts including messages,
|
|
60
|
-
* attachments, data, images, tables, and graphs. It provides methods to report and store test evidence
|
|
61
|
-
* in different formats and manages dependencies for reporting functionality.
|
|
62
|
-
*
|
|
63
|
-
* @template T - Type of data being reported
|
|
64
|
-
* @param {string} [testCase="tests"] - Name of the test case
|
|
65
|
-
* @param {string} [basePath] - Base path for storing test reports
|
|
66
|
-
* @class
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* const reporter = new TestReporter('login-test');
|
|
71
|
-
*
|
|
72
|
-
* // Report test messages
|
|
73
|
-
* await reporter.reportMessage('Test Started', 'Login flow initiated');
|
|
74
|
-
*
|
|
75
|
-
* // Report test data
|
|
76
|
-
* await reporter.reportData('user-credentials', { username: 'test' }, 'json');
|
|
77
|
-
*
|
|
78
|
-
* // Report test results table
|
|
79
|
-
* await reporter.reportTable('test-results', {
|
|
80
|
-
* headers: ['Step', 'Status'],
|
|
81
|
-
* rows: [
|
|
82
|
-
* { Step: 'Login', Status: 'Pass' },
|
|
83
|
-
* { Step: 'Validation', Status: 'Pass' }
|
|
84
|
-
* ]
|
|
85
|
-
* });
|
|
86
|
-
*
|
|
87
|
-
* // Report test evidence
|
|
88
|
-
* await reporter.reportAttachment('Screenshot', screenshotBuffer);
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @mermaid
|
|
92
|
-
* sequenceDiagram
|
|
93
|
-
* participant Client
|
|
94
|
-
* participant TestReporter
|
|
95
|
-
* participant FileSystem
|
|
96
|
-
* participant Dependencies
|
|
97
|
-
*
|
|
98
|
-
* Client->>TestReporter: new TestReporter(testCase, basePath)
|
|
99
|
-
* TestReporter->>FileSystem: Create report directory
|
|
100
|
-
*
|
|
101
|
-
* alt Report Message
|
|
102
|
-
* Client->>TestReporter: reportMessage(title, message)
|
|
103
|
-
* TestReporter->>Dependencies: Import helpers
|
|
104
|
-
* TestReporter->>FileSystem: Store message
|
|
105
|
-
* else Report Data
|
|
106
|
-
* Client->>TestReporter: reportData(reference, data, type)
|
|
107
|
-
* TestReporter->>Dependencies: Process data
|
|
108
|
-
* TestReporter->>FileSystem: Store formatted data
|
|
109
|
-
* else Report Table
|
|
110
|
-
* Client->>TestReporter: reportTable(reference, tableDef)
|
|
111
|
-
* TestReporter->>Dependencies: Convert to MD format
|
|
112
|
-
* TestReporter->>FileSystem: Store table
|
|
113
|
-
* end
|
|
114
|
-
*/
|
|
115
|
-
export declare class TestReporter {
|
|
116
|
-
protected testCase: string;
|
|
117
|
-
protected basePath: string;
|
|
118
|
-
/**
|
|
119
|
-
* @description Function for adding messages to the test report
|
|
120
|
-
* @summary Static handler for processing and storing test messages
|
|
121
|
-
* @type {function(AddMsgParams): Promise<void>}
|
|
122
|
-
*/
|
|
123
|
-
protected static addMsgFunction: (params: AddMsgParams) => Promise<void>;
|
|
124
|
-
/**
|
|
125
|
-
* @description Function for adding attachments to the test report
|
|
126
|
-
* @summary Static handler for processing and storing test attachments
|
|
127
|
-
* @type {function(AddAttachParams): Promise<void>}
|
|
128
|
-
*/
|
|
129
|
-
protected static addAttachFunction: (params: AddAttachParams) => Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* @description Map of dependencies required by the reporter
|
|
132
|
-
* @summary Stores the current state of dependencies
|
|
133
|
-
* @type {SimpleDependencyMap}
|
|
134
|
-
*/
|
|
135
|
-
private deps?;
|
|
136
|
-
/**
|
|
137
|
-
* @description Checks if storage is enabled via environment variables
|
|
138
|
-
* @summary Static getter for storage enablement status
|
|
139
|
-
* @type {boolean}
|
|
140
|
-
*/
|
|
141
|
-
static get storageEnabled(): boolean;
|
|
142
|
-
/**
|
|
143
|
-
* @description Gets the base path for evidence storage from environment variables or default
|
|
144
|
-
* @summary Static getter for evidence storage base path
|
|
145
|
-
* @type {string}
|
|
146
|
-
*/
|
|
147
|
-
static get storagePath(): string;
|
|
148
|
-
constructor(testCase?: string, basePath?: string);
|
|
149
|
-
/**
|
|
150
|
-
* @description Retrieves all evidences for a given describe and it name
|
|
151
|
-
* @summary Searches the storage directory for matching evidences using string inclusion
|
|
152
|
-
* @param {string} describeName - Name of the describe block to match
|
|
153
|
-
* @param {string} itName - Name of the it block to match
|
|
154
|
-
* @return {EvidenceData[]} Array of matching evidences
|
|
155
|
-
*/
|
|
156
|
-
static getEvidencesOf(describeName: string, itName: string): EvidenceData[];
|
|
157
|
-
/**
|
|
158
|
-
* @description Imports required helper functions
|
|
159
|
-
* @summary Ensures all necessary dependencies are available and imports helper functions
|
|
160
|
-
* @return {Promise<void>} Promise that resolves when helpers are imported
|
|
161
|
-
*/
|
|
162
|
-
private importHelpers;
|
|
163
|
-
private getJestHtmlReportersTempDir;
|
|
164
|
-
private ensureJestHtmlReportersTempDirs;
|
|
165
|
-
private overrideJestHtmlReportersTempPaths;
|
|
166
|
-
/**
|
|
167
|
-
* @description Reports a message to the test report
|
|
168
|
-
* @summary Adds a formatted message to the test report with an optional title
|
|
169
|
-
* @param {string} title - Title of the message
|
|
170
|
-
* @param {string | object} message - Content of the message
|
|
171
|
-
* @return {Promise<void>} Promise that resolves when the message is reported
|
|
172
|
-
*/
|
|
173
|
-
reportMessage(title: string, message: string | object): Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* @description Reports an attachment to the test report
|
|
176
|
-
* @summary Adds a formatted message to the test report with an optional title
|
|
177
|
-
* @param {string} title - Title of the message
|
|
178
|
-
* @param {string | Buffer} attachment - Content of the message
|
|
179
|
-
* @return {Promise<void>} Promise that resolves when the message is reported
|
|
180
|
-
*/
|
|
181
|
-
reportAttachment(title: string, attachment: string | Buffer): Promise<void>;
|
|
182
|
-
/**
|
|
183
|
-
* @description Reports data with specified type
|
|
184
|
-
* @summary Processes and stores data in the test report with formatting
|
|
185
|
-
* @param {string} reference - Reference identifier for the data
|
|
186
|
-
* @param {string | number | object} data - Data to be reported
|
|
187
|
-
* @param {PayloadType} type - Type of the payload
|
|
188
|
-
* @param {boolean} [trim=false] - Whether to trim the data
|
|
189
|
-
* @return {Promise<void>} Promise that resolves when data is reported
|
|
190
|
-
*/
|
|
191
|
-
protected report(reference: string, data: string | number | object | Buffer, type: PayloadType, trim?: boolean): Promise<void>;
|
|
192
|
-
/**
|
|
193
|
-
* @description Stores evidence to a file in the specified directory structure
|
|
194
|
-
* @summary Internal method to handle file-based storage of test artifacts
|
|
195
|
-
* @param {string} reference - Reference identifier for the data
|
|
196
|
-
* @param {any} data - Data to be stored
|
|
197
|
-
* @param {PayloadType} type - Type of the payload
|
|
198
|
-
* @param {string} extension - File extension to use
|
|
199
|
-
* @return {Promise<void>}
|
|
200
|
-
*/
|
|
201
|
-
private storeEvidence;
|
|
202
|
-
/**
|
|
203
|
-
* @description Reports data with a specified type
|
|
204
|
-
* @summary Wrapper method for reporting various types of data
|
|
205
|
-
* @param {string} reference - Reference identifier for the data
|
|
206
|
-
* @param {string | number | object} data - Data to be reported
|
|
207
|
-
* @param {PayloadType} [type="json"] - Type of the payload
|
|
208
|
-
* @param {boolean} [trim=false] - Whether to trim the data
|
|
209
|
-
* @return {Promise<void>} Promise that resolves when data is reported
|
|
210
|
-
*/
|
|
211
|
-
reportData(reference: string, data: string | number | object, type?: PayloadType, trim?: boolean): Promise<void>;
|
|
212
|
-
/**
|
|
213
|
-
* @description Reports a JSON object
|
|
214
|
-
* @summary Convenience method for reporting JSON objects
|
|
215
|
-
* @param {string} reference - Reference identifier for the object
|
|
216
|
-
* @param {object} json - JSON object to be reported
|
|
217
|
-
* @param {boolean} [trim=false] - Whether to trim the object
|
|
218
|
-
* @return {Promise<void>} Promise that resolves when object is reported
|
|
219
|
-
*/
|
|
220
|
-
reportObject(reference: string, json: object, trim?: boolean): Promise<void>;
|
|
221
|
-
/**
|
|
222
|
-
* @description Reports a table in markdown format
|
|
223
|
-
* @summary Converts and stores a table definition in markdown format
|
|
224
|
-
* @param {string} reference - Reference identifier for the table
|
|
225
|
-
* @param {MdTableDefinition} tableDef - Table definition object
|
|
226
|
-
* @return {Promise<void>} Promise that resolves when table is reported
|
|
227
|
-
*/
|
|
228
|
-
reportTable(reference: string, tableDef: MdTableDefinition): Promise<void>;
|
|
229
|
-
/**
|
|
230
|
-
* @description Reports a graph using Chart.js
|
|
231
|
-
* @summary Generates and stores a graph visualization
|
|
232
|
-
* @param {string} reference - Reference identifier for the graph
|
|
233
|
-
* @param {any} config - Chart.js configuration object
|
|
234
|
-
* @return {Promise<void>} Promise that resolves when graph is reported
|
|
235
|
-
*/
|
|
236
|
-
reportGraph(reference: string, config: any, width?: number, height?: number): Promise<Buffer>;
|
|
237
|
-
/**
|
|
238
|
-
* @description Reports an image to the test report
|
|
239
|
-
* @summary Stores an image buffer in the test report
|
|
240
|
-
* @param {string} reference - Reference identifier for the image
|
|
241
|
-
* @param {Buffer} buffer - Image data buffer
|
|
242
|
-
* @return {Promise<void>} Promise that resolves when image is reported
|
|
243
|
-
*/
|
|
244
|
-
reportImage(reference: string, buffer: Buffer): Promise<void>;
|
|
245
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { PerformanceScenario, PerformanceRunner, PhaseResult } from "../utils/performanceRunner";
|
|
2
|
-
export type JestPerformanceScenario<TContext = Record<string, unknown>> = PerformanceScenario<TContext>;
|
|
3
|
-
export declare class JestPerformanceRunner<TContext = Record<string, unknown>> extends PerformanceRunner<TContext> {
|
|
4
|
-
protected scenario: JestPerformanceScenario<TContext>;
|
|
5
|
-
private readonly reporter;
|
|
6
|
-
constructor(scenario: JestPerformanceScenario<TContext>);
|
|
7
|
-
/** Disable the base-class text-table canvas; we render a proper bar chart instead. */
|
|
8
|
-
protected shouldRenderCanvas(): boolean;
|
|
9
|
-
/** Logs per-phase table to the jest-html-reporters attachment. */
|
|
10
|
-
private reportPhaseToReporter;
|
|
11
|
-
/**
|
|
12
|
-
* After all phases finish: console-log the combined summary (base class),
|
|
13
|
-
* then report the summary table and a bar chart with the reporter.
|
|
14
|
-
*/
|
|
15
|
-
protected logSummary(results: PhaseResult<TContext>[]): Promise<void>;
|
|
16
|
-
private buildTableDef;
|
|
17
|
-
/**
|
|
18
|
-
* Builds a Chart.js config: grouped bar columns (Wall/Avg/Min/Max ms)
|
|
19
|
-
* with a red line overlay for failure counts on a secondary right axis.
|
|
20
|
-
*/
|
|
21
|
-
private buildPhaseChart;
|
|
22
|
-
/**
|
|
23
|
-
* Registers Jest describe/it blocks for the scenario.
|
|
24
|
-
* Creates one `it` per phase — its never fail, errors are only recorded
|
|
25
|
-
* in aggregated results. Logs a per-phase console table and reports it
|
|
26
|
-
* via TestReporter after each `it`; reports combined table + bar chart
|
|
27
|
-
* in `afterAll`.
|
|
28
|
-
*
|
|
29
|
-
* @param hooks Optional lifecycle hooks:
|
|
30
|
-
* - `beforeAll`: runs after `scenario.initialize` but before any `it`.
|
|
31
|
-
* Use this to populate shared mutable state (e.g. metadata objects)
|
|
32
|
-
* that phase configs reference.
|
|
33
|
-
*/
|
|
34
|
-
describeSuite(hooks?: {
|
|
35
|
-
beforeAll?: () => Promise<void> | void;
|
|
36
|
-
}): void;
|
|
37
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { SpawnOptionsWithoutStdio } from "child_process";
|
|
2
|
-
import { OutputWriterConstructor, StandardOutputWriter } from "../writers";
|
|
3
|
-
import { CommandResult } from "../utils/types";
|
|
4
|
-
import { TestReporter } from "./TestReporter";
|
|
5
|
-
export declare function runAndReport<R = string>(command: string, opts: SpawnOptionsWithoutStdio | undefined, outputConstructor: OutputWriterConstructor<R, StandardOutputWriter<R>, Error> | undefined, reporter: TestReporter, commandPrefix?: string, ...args: unknown[]): CommandResult<R>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Default encoding for text operations.
|
|
3
|
-
* @summary The standard UTF-8 encoding used for text processing.
|
|
4
|
-
* @const {string} Encoding
|
|
5
|
-
* @memberOf module:utils
|
|
6
|
-
*/
|
|
7
|
-
export declare const Encoding = "utf-8";
|
|
8
|
-
/**
|
|
9
|
-
* @description Regular expression for semantic versioning.
|
|
10
|
-
* @summary A regex pattern to match and parse semantic version strings.
|
|
11
|
-
* @const {RegExp} SemVersionRegex
|
|
12
|
-
* @memberOf module:utils
|
|
13
|
-
*/
|
|
14
|
-
export declare const SemVersionRegex: RegExp;
|
|
15
|
-
/**
|
|
16
|
-
* @description Enum for semantic version components.
|
|
17
|
-
* @summary Defines the three levels of semantic versioning: PATCH, MINOR, and MAJOR.
|
|
18
|
-
* @enum {string}
|
|
19
|
-
* @memberOf module:utils
|
|
20
|
-
*/
|
|
21
|
-
export declare enum SemVersion {
|
|
22
|
-
/** Patch version for backwards-compatible bug fixes. */
|
|
23
|
-
PATCH = "patch",
|
|
24
|
-
/** Minor version for backwards-compatible new features. */
|
|
25
|
-
MINOR = "minor",
|
|
26
|
-
/** Major version for changes that break backwards compatibility. */
|
|
27
|
-
MAJOR = "major"
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @description Flag to indicate non-CI environment.
|
|
31
|
-
* @summary Used to specify that a command should run outside of a Continuous Integration environment.
|
|
32
|
-
* @const {string} NoCIFLag
|
|
33
|
-
* @memberOf module:utils
|
|
34
|
-
*/
|
|
35
|
-
export declare const NoCIFLag = "-no-ci";
|
|
36
|
-
/**
|
|
37
|
-
* @description Key for the setup script in package.json.
|
|
38
|
-
* @summary Identifies the script that runs after package installation.
|
|
39
|
-
* @const {string} SetupScriptKey
|
|
40
|
-
* @memberOf module:utils
|
|
41
|
-
*/
|
|
42
|
-
export declare const SetupScriptKey = "postinstall";
|
|
43
|
-
/**
|
|
44
|
-
* @description Enum for various authentication tokens.
|
|
45
|
-
* @summary Defines the file names for storing different types of authentication tokens.
|
|
46
|
-
* @enum {string}
|
|
47
|
-
* @memberOf module:utils
|
|
48
|
-
*/
|
|
49
|
-
export declare enum Tokens {
|
|
50
|
-
/** Git authentication token file name. */
|
|
51
|
-
GIT = ".token",
|
|
52
|
-
/** NPM authentication token file name. */
|
|
53
|
-
NPM = ".npmtoken",
|
|
54
|
-
/** Docker authentication token file name. */
|
|
55
|
-
DOCKER = ".dockertoken",
|
|
56
|
-
/** Confluence authentication token file name. */
|
|
57
|
-
CONFLUENCE = ".confluence-token"
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @description Code used to indicate an operation was aborted.
|
|
61
|
-
* @summary Standard message used when a process is manually terminated.
|
|
62
|
-
* @const {string} AbortCode
|
|
63
|
-
* @memberOf module:utils
|
|
64
|
-
*/
|
|
65
|
-
export declare const AbortCode = "Aborted";
|