cucumber: add missing props to ScenarioResult and StepDefinition (#40102)

* add optional `exception` to HookScenarioResult

* add optional unwrappedCode prop to StepDefinition

* update cucumber-js version in header
This commit is contained in:
David Goss
2019-11-05 22:04:50 +00:00
committed by Nathan Shively-Sanders
parent 8f92920eb8
commit 0b54fd9eee
2 changed files with 13 additions and 2 deletions

View File

@@ -60,6 +60,13 @@ function StepSampleWithoutDefineSupportCode() {
callback();
});
After((scenarioResult: HookScenarioResult, callback: Callback) => {
if (scenarioResult.result.exception) {
console.error(scenarioResult.result.exception);
}
callback();
});
After({ timeout: 1000 }, (scenarioResult: HookScenarioResult, callback: Callback) => {
console.log("After");
callback();

View File

@@ -1,4 +1,4 @@
// Type definitions for cucumber-js 4.0
// Type definitions for cucumber-js 6.0
// Project: http://github.com/cucumber/cucumber-js
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
// Jan Molak <https://github.com/jan-molak>
@@ -7,6 +7,7 @@
// ErikSchierboom <https://github.com/ErikSchierboom>
// Peter Morlion <https://github.com/petermorlion>
// Don Jayamanne <https://github.com/DonJayamanne>
// David Goss <https://github.com/davidjgoss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -97,6 +98,7 @@ export interface SourceLocation {
export interface ScenarioResult {
duration: number;
status: Status;
exception?: Error;
}
export namespace pickle {
@@ -253,8 +255,10 @@ export namespace events {
}
export interface StepDefinition {
// tslint:disable-next-line ban-types
// tslint:disable:ban-types
code: Function;
unwrappedCode?: Function;
// tslint:enable:ban-types
line: number;
options: {};
pattern: any;