Skip to content

Commit bf72436

Browse files
authored
[patch] inherit before each/after each hooks step status (#222)
1 parent 024ea6a commit bf72436

11 files changed

+509
-10
lines changed

src/plugins/helper.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,23 @@ export const wrapHooks = (
127127
if (endIndex !== undefined && startIndex !== undefined && startIndex !== endIndex) {
128128
const childrenBeforeEach = steps.slice(startIndex, endIndex + 1);
129129

130+
const nonSuccess = childrenBeforeEach.filter(x => x.status !== ('passed' as Status));
131+
const status = nonSuccess.length > 0 ? nonSuccess[0].status : ('passed' as Status);
132+
const startTime = childrenBeforeEach[0]?.start ?? undefined;
133+
const endTime = childrenBeforeEach[childrenBeforeEach.length - 1].stop ?? undefined;
134+
130135
return [
131136
...steps.slice(0, startIndex),
132137
{
133138
name: `${stepName}s`,
134139
steps: childrenBeforeEach,
135-
status: 'passed' as Status,
140+
status,
136141
statusDetails: {},
137142
stage: 'finished' as Stage,
138143
attachments: [],
139144
parameters: [],
145+
start: startTime,
146+
stop: endTime,
140147
},
141148
...steps.slice(endIndex + 1),
142149
];

0 commit comments

Comments
 (0)