Skip to content

Commit 48665ab

Browse files
feat: made executionTimeout optional for exported respect-core run (#2233)
1 parent f119dc5 commit 48665ab

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

.changeset/eight-buckets-end.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@redocly/respect-core": patch
3+
"@redocly/cli": patch
4+
---
5+
6+
Made `executionTimeout` parameter optional in the `run` function exported from `respect-core`.

packages/respect-core/src/modules/__tests__/flow-runner/run-step.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ const basicCTX = {
608608
workflow: undefined,
609609
skip: undefined,
610610
verbose: true,
611+
executionTimeout: 3_600_000,
611612
metadata: {
612613
_: [],
613614
files: ['runStepTest.yml'],

packages/respect-core/src/modules/flow-runner/run-step.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ export async function runStep({
164164
return { shouldEnd: true };
165165
}
166166

167-
if (Timer.getInstance(ctx.options.executionTimeout).isTimedOut()) {
167+
if (
168+
ctx.options.executionTimeout &&
169+
Timer.getInstance(ctx.options.executionTimeout).isTimedOut()
170+
) {
168171
step.checks.push({
169172
name: CHECKS.GLOBAL_TIMEOUT_ERROR,
170173
message: `Global Respect timer reached`,

packages/respect-core/src/run.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export type RespectOptions = {
2020
config: Config;
2121
maxSteps: number;
2222
maxFetchTimeout: number;
23-
executionTimeout: number;
23+
executionTimeout?: number;
2424
collectSpecData?: CollectFn;
2525
requestFileLoader: { getFileBody: (filePath: string) => Promise<Blob> };
2626
envVariables?: Record<string, string>;
@@ -34,7 +34,8 @@ export type RespectOptions = {
3434
export async function run(options: RespectOptions): Promise<RunFileResult[]> {
3535
const { files, executionTimeout, collectSpecData } = options;
3636

37-
Timer.getInstance(executionTimeout);
37+
// Don't create a timer if executionTimeout is not set
38+
executionTimeout && Timer.getInstance(executionTimeout);
3839

3940
const testsRunProblemsStatus: boolean[] = [];
4041
const runAllFilesResult = [];

packages/respect-core/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export type AppOptions = {
124124
severity?: string | string[];
125125
maxSteps: number;
126126
maxFetchTimeout: number;
127-
executionTimeout: number;
127+
executionTimeout?: number;
128128
config: Config;
129129
requestFileLoader: { getFileBody: (filePath: string) => Promise<Blob> };
130130
fetch: typeof fetch;

0 commit comments

Comments
 (0)