Skip to content

Commit

Permalink
fix: conversion script
Browse files Browse the repository at this point in the history
- make attempt to start from 0

- make stderr, stdout and errors arrays required
  • Loading branch information
vCaisim committed Nov 25, 2024
1 parent db563f7 commit 234bcd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions packages/cmd/src/services/convert/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,16 @@ function getTestAttempts(
return [
{
_s: 'passed',
attempt: 1,
attempt: 0,
workerIndex: 1,
parallelIndex: 1,
startTime: suiteTimestamp,
steps: [],
duration: testCaseTime,
status: 'passed',
stdout: getStdOut(testCase?.['system-out']),
stderr: undefined,
errors: undefined,
stderr: [],
errors: [],
error: undefined,
},
];
Expand All @@ -122,7 +122,7 @@ function getTestAttempts(
const errors = getErrors(item);
acc.push({
_s: 'failed' as TestCaseStatus,
attempt: index + 1,
attempt: index,
workerIndex: 1,
parallelIndex: 1,
startTime: getTestStartTime(time, suiteTimestamp),
Expand All @@ -140,16 +140,16 @@ function getTestAttempts(
}

function getStdOut(systemOut?: string) {
return systemOut ? [systemOut] : undefined;
return systemOut ? [systemOut] : [];
}

function getStdErr(systemErr?: string) {
return systemErr ? [systemErr] : undefined;
return systemErr ? [systemErr] : [];
}

function getErrors(failure: Failure | string): ErrorSchema[] | undefined {
function getErrors(failure: Failure | string): ErrorSchema[] {
if (failure === 'true' || failure === 'false') {
return undefined;
return [];
}

const error: ErrorSchema =
Expand Down
6 changes: 3 additions & 3 deletions packages/cmd/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export type InstanceReportTestAttempt = {
duration: number;
status: TestRunnerStatus;

stderr?: string[];
stdout?: string[];
stderr: string[];
stdout: string[];

errors?: ErrorSchema[];
errors: ErrorSchema[];
error?: ErrorSchema;
};

Expand Down

0 comments on commit 234bcd3

Please sign in to comment.