Skip to content

Commit adb2b59

Browse files
committed
chore(respect): cleanup display table after timer check logic changes
1 parent e12f9fe commit adb2b59

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

packages/respect-core/src/modules/cli-output/display-files-summary-table.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export function displayFilesSummaryTable(
1414
hasProblems: boolean;
1515
executedWorkflows: WorkflowExecutionResult[];
1616
argv?: { workflow?: string[]; skip?: string[] };
17-
globalTimeoutError: boolean;
1817
}[]
1918
) {
2019
const DEFAULT_FILENAME_PADDING = 40;
@@ -42,7 +41,7 @@ export function displayFilesSummaryTable(
4241
output += `${gray(`├${columns.map((col) => '─'.repeat(col.width + 2)).join('┼')}┤`)}\n`;
4342

4443
// Data rows
45-
filesResult.forEach(({ file, executedWorkflows: workflows, argv, globalTimeoutError }) => {
44+
filesResult.forEach(({ file, executedWorkflows: workflows, argv }) => {
4645
const fileName = path.basename(file);
4746
const workflowArgv = argv?.workflow || [];
4847
const skippedWorkflowArgv = argv?.skip || [];
@@ -70,10 +69,9 @@ export function displayFilesSummaryTable(
7069
: gray('-'.padEnd(9));
7170

7271
// First pad the content, then add colors
73-
const statusSymbol = testWorkflows.failed > 0 || globalTimeoutError ? 'x' : '✓';
72+
const statusSymbol = testWorkflows.failed > 0 ? 'x' : '✓';
7473
const paddedContent = `${statusSymbol} ${fileName}`.padEnd(maxFilenameLength + 1);
75-
const fileNameWithStatus =
76-
testWorkflows.failed > 0 || globalTimeoutError ? red(paddedContent) : green(paddedContent);
74+
const fileNameWithStatus = testWorkflows.failed > 0 ? red(paddedContent) : green(paddedContent);
7775

7876
output +=
7977
gray('│') +

packages/respect-core/src/modules/timeout-timer/timer.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@ export class Timer {
1515
return Timer.instance;
1616
}
1717

18-
private getTimeout(): number {
19-
return parseInt(process.env.RESPECT_TIMEOUT || RESPECT_TIMEOUT.toString(), 10);
20-
}
21-
22-
public getRemainingTime(): number {
18+
public isTimedOut(): boolean {
2319
const elapsedTime = Date.now() - this.startTime;
24-
const timeout = this.getTimeout();
25-
return Math.max(0, timeout - elapsedTime);
26-
}
20+
const timeout = parseInt(process.env.RESPECT_TIMEOUT || RESPECT_TIMEOUT.toString(), 10);
21+
const remainingTime = Math.max(0, timeout - elapsedTime);
2722

28-
public isTimedOut(): boolean {
29-
return this.getRemainingTime() <= 0;
23+
return remainingTime <= 0;
3024
}
3125
}

0 commit comments

Comments
 (0)