Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const step of this.stepStack.reverse()) {
step.status = Status.BROKEN;
step.stage = Stage.INTERRUPTED;
step.detailsMessage = "Timeout";
step.endStep();
}
this.stepStack = [];
}
if (spec.status === SpecStatus.PENDING || spec.status === SpecStatus.DISABLED
|| spec.status === SpecStatus.EXCLUDED) {
currentTest.status = Status.SKIPPED;
currentTest.stage = Stage.PENDING;
currentTest.detailsMessage = spec.pendingReason || "Suite disabled";
}
currentTest.stage = Stage.FINISHED;
if (spec.status === SpecStatus.PASSED) {
currentTest.status = Status.PASSED;
}
if (spec.status === SpecStatus.BROKEN) {
currentTest.status = Status.BROKEN;
}
if (spec.status === SpecStatus.FAILED) {
currentTest.status = Status.FAILED;
}
const exceptionInfo = this.findMessageAboutThrow(spec.failedExpectations)
|| this.findAnyError(spec.failedExpectations);
if (exceptionInfo !== null) {
currentTest.detailsMessage = exceptionInfo.message;
currentTest.detailsTrace = exceptionInfo.stack;
}
export function statusTextToStage(status?: string): Stage {
if (status === "passed") return Stage.FINISHED;
if (status === "skipped") return Stage.PENDING;
if (status === "failed") return Stage.INTERRUPTED;
return Stage.INTERRUPTED;
}
private endTest(status: Status, details?: StatusDetails): void {
if (this.currentTest === null) {
throw new Error("endTest while no test is running");
}
if (details) {
this.currentTest.statusDetails = details;
}
this.currentTest.status = status;
this.currentTest.stage = Stage.FINISHED;
this.currentTest.endTest();
}
}