Interface NamedStep
interface NamedStep {
onAttempt(attempt: number): AttemptScript;
onEveryAttempt(): AttemptScript;
onRemainingAttempts(): AttemptScript;
willContribute<T>(key: string, value: T & AsValue<T>): AttemptContributing;
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmitting;
willFail(reason: string | Reason): StepScript;
willRunForReal(): StepScript;
willSetGlobalMetadata<T>(
key: string,
value: T & AsValue<T>,
): AttemptSettingGlobalMetadata;
willSkip(): StepScript;
willSkipBecause(reason: string | Reason): StepScript;
willSucceed(): StepScript;
willTerminateAbnormally(errorMessage: string): StepScript;
}
onAttempt(attempt: number): AttemptScript;
onEveryAttempt(): AttemptScript;
onRemainingAttempts(): AttemptScript;
willContribute<T>(key: string, value: T & AsValue<T>): AttemptContributing;
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmitting;
willFail(reason: string | Reason): StepScript;
willRunForReal(): StepScript;
willSetGlobalMetadata<T>(
key: string,
value: T & AsValue<T>,
): AttemptSettingGlobalMetadata;
willSkip(): StepScript;
willSkipBecause(reason: string | Reason): StepScript;
willSucceed(): StepScript;
willTerminateAbnormally(errorMessage: string): StepScript;
}
Hierarchy (View Summary)
- AttemptChoice
- AttemptScript
- NamedStep
Methods
on Attempt
-
Describes attempt
attempt, the attempt after the last one described.Parameters
- attempt: number
Returns AttemptScript
on Every Attempt
-
Describes every attempt.
Returns AttemptScript
on Remaining Attempts
-
Describes every attempt not yet described.
Returns AttemptScript
will Contribute
-
The attempts contribute
valueunderkey, committed only when an attempt succeeds, as a step's contributions are.Type Parameters
- T
Returns AttemptContributing
will Emit
-
willEmit<T = undefined>(
level: "error" | "info" | "warning",
message: string,
data?: T & AsValue<T>,
): AttemptEmittingThe attempts emit an event at
level, withmessageand, if given,data, as the step's reporter would.Type Parameters
- T = undefined
Returns AttemptEmitting
will Fail
-
The attempts fail, for
reason, or a reason with only this code.Parameters
- reason: string | Reason
Returns StepScript
will Run For Real
-
The attempts run the real step.
Returns StepScript
will Set Global Metadata
-
The attempts set the global metadata
keytovalue, as the step's reporter would.Type Parameters
- T
Returns AttemptSettingGlobalMetadata
will Skip
-
The step skips itself, giving no reason.
Returns StepScript
will Skip Because
-
The step skips itself, for
reason, or a reason with only this code.Parameters
- reason: string | Reason
Returns StepScript
will Succeed
-
The attempts succeed.
Returns StepScript
will Terminate Abnormally
-
The attempts terminate abnormally, with an error carrying
errorMessage.Parameters
- errorMessage: string
Returns StepScript
The step just named: its attempts are chosen, or attempt 1 is described.