mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
[cucumber] Update the HookScenarioResult to match the v3 api (#22651)
This commit is contained in:
committed by
Mohamed Hegazy
parent
ceb0c84473
commit
fa5b175189
@@ -24,17 +24,17 @@ function StepSample() {
|
||||
});
|
||||
|
||||
Before((scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.status === Status.FAILED);
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.status === Status.FAILED);
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
Before('@tag', (scenarioResult: HookScenarioResult, callback: Callback) => {
|
||||
console.log(scenarioResult.status === Status.FAILED);
|
||||
console.log(scenarioResult.result.status === Status.FAILED);
|
||||
callback();
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ function StepSample() {
|
||||
});
|
||||
|
||||
Around((scenarioResult: HookScenarioResult, runScenario: (error: string | null, callback?: () => void) => void) => {
|
||||
if (scenarioResult.status === Status.FAILED) {
|
||||
if (scenarioResult.result.status === Status.FAILED) {
|
||||
runScenario(null, () => {
|
||||
console.log('finish tasks');
|
||||
});
|
||||
|
||||
44
types/cucumber/index.d.ts
vendored
44
types/cucumber/index.d.ts
vendored
@@ -50,11 +50,49 @@ export interface StepDefinitions {
|
||||
}
|
||||
|
||||
export interface HookScenarioResult {
|
||||
sourceLocation: SourceLocation;
|
||||
result: ScenarioResult;
|
||||
pickle: pickle.Pickle;
|
||||
}
|
||||
|
||||
export interface SourceLocation {
|
||||
line: number;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface ScenarioResult {
|
||||
duration: number;
|
||||
failureException: Error;
|
||||
scenario: Scenario;
|
||||
status: Status;
|
||||
stepsResults: any;
|
||||
}
|
||||
|
||||
export namespace pickle {
|
||||
interface Pickle {
|
||||
language: string;
|
||||
locations: Location[];
|
||||
name: string;
|
||||
steps: Step[];
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
interface Location {
|
||||
column: number;
|
||||
line: number;
|
||||
}
|
||||
|
||||
interface Step {
|
||||
arguments: Argument[];
|
||||
locations: Location[];
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface Argument {
|
||||
rows: Cell[];
|
||||
}
|
||||
|
||||
interface Cell {
|
||||
location: Location;
|
||||
value: string;
|
||||
}
|
||||
}
|
||||
|
||||
export type HookCode = (this: World, scenario: HookScenarioResult, callback?: CallbackStepDefinition) => void;
|
||||
|
||||
Reference in New Issue
Block a user