Skip to content

Commit

Permalink
[patch] inherit before each/after each hooks step status (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmisty authored Aug 15, 2024
1 parent 024ea6a commit bf72436
Show file tree
Hide file tree
Showing 11 changed files with 509 additions and 10 deletions.
9 changes: 8 additions & 1 deletion src/plugins/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,23 @@ export const wrapHooks = (
if (endIndex !== undefined && startIndex !== undefined && startIndex !== endIndex) {
const childrenBeforeEach = steps.slice(startIndex, endIndex + 1);

const nonSuccess = childrenBeforeEach.filter(x => x.status !== ('passed' as Status));
const status = nonSuccess.length > 0 ? nonSuccess[0].status : ('passed' as Status);
const startTime = childrenBeforeEach[0]?.start ?? undefined;
const endTime = childrenBeforeEach[childrenBeforeEach.length - 1].stop ?? undefined;

return [
...steps.slice(0, startIndex),
{
name: `${stepName}s`,
steps: childrenBeforeEach,
status: 'passed' as Status,
status,
statusDetails: {},
stage: 'finished' as Stage,
attachments: [],
parameters: [],
start: startTime,
stop: endTime,
},
...steps.slice(endIndex + 1),
];
Expand Down
Loading

0 comments on commit bf72436

Please sign in to comment.