@wdio/cucumber-framework 8.22.0 → 8.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/constants.d.ts +1 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +6 -0
- package/build/index.d.ts +19 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +62 -30
- package/build/types.d.ts +6 -0
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +7 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +23 -0
- package/package.json +4 -4
package/build/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CucumberOptions } from './types.js';
|
|
2
2
|
export declare const DEFAULT_TIMEOUT = 60000;
|
|
3
3
|
export declare const DEFAULT_OPTS: CucumberOptions;
|
|
4
|
+
export declare const CUCUMBER_HOOK_DEFINITION_TYPES: readonly ["beforeTestRunHookDefinitionConfigs", "beforeTestCaseHookDefinitionConfigs", "afterTestCaseHookDefinitionConfigs", "afterTestRunHookDefinitionConfigs"];
|
|
4
5
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,YAAY,EAAE,eA0B1B,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,YAAY,EAAE,eA0B1B,CAAA;AAED,eAAO,MAAM,8BAA8B,mKAKjC,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -26,3 +26,9 @@ export const DEFAULT_OPTS = {
|
|
|
26
26
|
tagExpression: '',
|
|
27
27
|
profiles: []
|
|
28
28
|
};
|
|
29
|
+
export const CUCUMBER_HOOK_DEFINITION_TYPES = [
|
|
30
|
+
'beforeTestRunHookDefinitionConfigs',
|
|
31
|
+
'beforeTestCaseHookDefinitionConfigs',
|
|
32
|
+
'afterTestCaseHookDefinitionConfigs',
|
|
33
|
+
'afterTestRunHookDefinitionConfigs',
|
|
34
|
+
];
|
package/build/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Capabilities, Options } from '@wdio/types';
|
|
|
4
4
|
import { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, When, Then, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, defineParameterType, defineStep, DataTable, World } from '@cucumber/cucumber';
|
|
5
5
|
import type { GherkinDocument } from '@cucumber/messages';
|
|
6
6
|
import type Cucumber from '@cucumber/cucumber';
|
|
7
|
-
import type { CucumberOptions, HookFunctionExtension as HookFunctionExtensionImport } from './types.js';
|
|
7
|
+
import type { CucumberOptions, HookFunctionExtension as HookFunctionExtensionImport, StepDefinitionOptions } from './types.js';
|
|
8
8
|
export declare const FILE_PROTOCOL = "file://";
|
|
9
9
|
declare class CucumberAdapter {
|
|
10
10
|
private _cid;
|
|
@@ -44,7 +44,24 @@ declare class CucumberAdapter {
|
|
|
44
44
|
* set `beforeFeature`, `afterFeature`, `beforeScenario`, `afterScenario`, 'beforeStep', 'afterStep'
|
|
45
45
|
* @param {object} config config
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
addWdioHooks(config: Options.Testrunner, supportCodeLibraryBuilder: typeof Cucumber.supportCodeLibraryBuilder): void;
|
|
48
|
+
/**
|
|
49
|
+
* wraps step definition code with sync/async runner with a retry option
|
|
50
|
+
* @param {object} config
|
|
51
|
+
*/
|
|
52
|
+
wrapSteps(config: Options.Testrunner): void;
|
|
53
|
+
/**
|
|
54
|
+
* wrap step definition to enable retry ability
|
|
55
|
+
* @param {Function} code step definition
|
|
56
|
+
* @param {boolean} isStep
|
|
57
|
+
* @param {object} config
|
|
58
|
+
* @param {string} cid cid
|
|
59
|
+
* @param {StepDefinitionOptions} options
|
|
60
|
+
* @param {Function} getHookParams step definition
|
|
61
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
62
|
+
* @return {Function} wrapped step definition for sync WebdriverIO code
|
|
63
|
+
*/
|
|
64
|
+
wrapStep(code: Function, isStep: boolean, config: Options.Testrunner, cid: string, options: StepDefinitionOptions, getHookParams: Function, timeout?: number, hookName?: string | undefined): Function;
|
|
48
65
|
}
|
|
49
66
|
/**
|
|
50
67
|
* Publishes a Cucumber report to a specified URL using NDJSON files from a directory.
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAS1C,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAc,MAAM,aAAa,CAAA;AAEpE,OAAO,EACH,KAAK,EACL,QAAQ,EACR,SAAS,EAET,MAAM,EACN,SAAS,EACT,UAAU,EAEV,KAAK,EACL,IAAI,EACJ,IAAI,EAEJ,iBAAiB,EACjB,4BAA4B,EAE5B,mBAAmB,EACnB,mBAAmB,EACnB,UAAU,EAEV,SAAS,EACT,KAAK,EAER,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAAW,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAM9C,OAAO,KAAK,EACR,eAAe,EACf,qBAAqB,IAAI,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA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nB,UAAU,EAEV,qBAAqB,EACxB,CAAA;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,YAAa,SAAQ,eAAe;SAAG;QACjD,UAAU,qBAAsB,SAAQ,2BAA2B;SAAG;KACzE;CACJ"}
|
package/build/index.js
CHANGED
|
@@ -9,13 +9,13 @@ import got from 'got';
|
|
|
9
9
|
import isGlob from 'is-glob';
|
|
10
10
|
import { sync as globSync } from 'glob';
|
|
11
11
|
import logger from '@wdio/logger';
|
|
12
|
-
import { executeHooksWithArgs } from '@wdio/utils';
|
|
12
|
+
import { executeHooksWithArgs, testFnWrapper } from '@wdio/utils';
|
|
13
13
|
import { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, When, Then, setDefaultTimeout, setDefinitionFunctionWrapper, supportCodeLibraryBuilder, setWorldConstructor, defineParameterType, defineStep, DataTable, World, Status } from '@cucumber/cucumber';
|
|
14
14
|
import Gherkin from '@cucumber/gherkin';
|
|
15
15
|
import { IdGenerator } from '@cucumber/messages';
|
|
16
16
|
import { loadConfiguration, loadSources, runCucumber } from '@cucumber/cucumber/api';
|
|
17
17
|
import { DEFAULT_OPTS } from './constants.js';
|
|
18
|
-
import { generateSkipTagsFromCapabilities } from './utils.js';
|
|
18
|
+
import { generateSkipTagsFromCapabilities, setUserHookNames } from './utils.js';
|
|
19
19
|
export const FILE_PROTOCOL = 'file://';
|
|
20
20
|
const uuidFn = IdGenerator.uuid();
|
|
21
21
|
const log = logger('@wdio/cucumber-framework');
|
|
@@ -165,9 +165,11 @@ class CucumberAdapter {
|
|
|
165
165
|
requirePaths: this._cucumberOpts.require,
|
|
166
166
|
importPaths: this._cucumberOpts.import,
|
|
167
167
|
});
|
|
168
|
-
this.
|
|
169
|
-
setDefaultTimeout(this._cucumberOpts.timeout);
|
|
168
|
+
this.addWdioHooks(this._config, supportCodeLibraryBuilder);
|
|
170
169
|
await this.loadFiles();
|
|
170
|
+
this.wrapSteps(this._config);
|
|
171
|
+
setUserHookNames(supportCodeLibraryBuilder);
|
|
172
|
+
setDefaultTimeout(this._cucumberOpts.timeout);
|
|
171
173
|
const supportCodeLibrary = supportCodeLibraryBuilder.finalize();
|
|
172
174
|
outStream = new Writable({
|
|
173
175
|
write(chunk, encoding, callback) {
|
|
@@ -270,29 +272,29 @@ class CucumberAdapter {
|
|
|
270
272
|
* set `beforeFeature`, `afterFeature`, `beforeScenario`, `afterScenario`, 'beforeStep', 'afterStep'
|
|
271
273
|
* @param {object} config config
|
|
272
274
|
*/
|
|
273
|
-
|
|
275
|
+
addWdioHooks(config, supportCodeLibraryBuilder) {
|
|
274
276
|
const params = {};
|
|
275
277
|
this._eventEmitter.on('getHookParams', (payload) => {
|
|
276
278
|
params.uri = payload.uri;
|
|
277
279
|
params.feature = payload.feature;
|
|
278
280
|
});
|
|
279
|
-
supportCodeLibraryBuilder.methods.BeforeAll(async function () {
|
|
281
|
+
supportCodeLibraryBuilder.methods.BeforeAll(async function wdioHookBeforeFeature() {
|
|
280
282
|
await executeHooksWithArgs('beforeFeature', config.beforeFeature, [
|
|
281
283
|
params.uri,
|
|
282
284
|
params.feature,
|
|
283
285
|
]);
|
|
284
286
|
});
|
|
285
|
-
supportCodeLibraryBuilder.methods.Before(async function (world) {
|
|
287
|
+
supportCodeLibraryBuilder.methods.Before(async function wdioHookBeforeScenario(world) {
|
|
286
288
|
await executeHooksWithArgs('beforeScenario', config.beforeScenario, [world, this]);
|
|
287
289
|
});
|
|
288
|
-
supportCodeLibraryBuilder.methods.BeforeStep(async function (world) {
|
|
290
|
+
supportCodeLibraryBuilder.methods.BeforeStep(async function wdioHookBeforeStep(world) {
|
|
289
291
|
await executeHooksWithArgs('beforeStep', config.beforeStep, [
|
|
290
292
|
world.pickleStep,
|
|
291
293
|
world.pickle,
|
|
292
294
|
this,
|
|
293
295
|
]);
|
|
294
296
|
});
|
|
295
|
-
supportCodeLibraryBuilder.methods.AfterStep(async function (world) {
|
|
297
|
+
supportCodeLibraryBuilder.methods.AfterStep(async function wdioHookAfterStep(world) {
|
|
296
298
|
await executeHooksWithArgs('afterStep', config.afterStep, [
|
|
297
299
|
world.pickleStep,
|
|
298
300
|
world.pickle,
|
|
@@ -300,41 +302,71 @@ class CucumberAdapter {
|
|
|
300
302
|
this,
|
|
301
303
|
]);
|
|
302
304
|
});
|
|
303
|
-
supportCodeLibraryBuilder.methods.After(async function (world) {
|
|
305
|
+
supportCodeLibraryBuilder.methods.After(async function wdioHookAfterScenario(world) {
|
|
304
306
|
await executeHooksWithArgs('afterScenario', config.afterScenario, [
|
|
305
307
|
world,
|
|
306
308
|
getResultObject(world),
|
|
307
309
|
this,
|
|
308
310
|
]);
|
|
309
311
|
});
|
|
310
|
-
supportCodeLibraryBuilder.methods.AfterAll(async function () {
|
|
312
|
+
supportCodeLibraryBuilder.methods.AfterAll(async function wdioHookAfterFeature() {
|
|
311
313
|
await executeHooksWithArgs('afterFeature', config.afterFeature, [
|
|
312
314
|
params.uri,
|
|
313
315
|
params.feature,
|
|
314
316
|
]);
|
|
315
317
|
});
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* wraps step definition code with sync/async runner with a retry option
|
|
321
|
+
* @param {object} config
|
|
322
|
+
*/
|
|
323
|
+
wrapSteps(config) {
|
|
324
|
+
const wrapStep = this.wrapStep;
|
|
325
|
+
const cid = this._cid;
|
|
326
|
+
let params;
|
|
327
|
+
this._eventEmitter.on('getHookParams', (payload) => {
|
|
328
|
+
params = payload;
|
|
329
|
+
});
|
|
330
|
+
const getHookParams = () => params;
|
|
331
|
+
setDefinitionFunctionWrapper((fn, options = { retry: 0 }) => {
|
|
332
|
+
/**
|
|
333
|
+
* hooks defined in wdio.conf are already wrapped
|
|
334
|
+
*/
|
|
335
|
+
if (fn.name.startsWith('wdioHook')) {
|
|
336
|
+
return fn;
|
|
334
337
|
}
|
|
335
|
-
|
|
338
|
+
/**
|
|
339
|
+
* this flag is used to:
|
|
340
|
+
* - avoid hook retry
|
|
341
|
+
* - avoid wrap hooks with beforeStep and afterStep
|
|
342
|
+
*/
|
|
343
|
+
const isStep = !fn.name.startsWith('userHook');
|
|
344
|
+
return wrapStep(fn, isStep, config, cid, options, getHookParams, this._cucumberOpts.timeout);
|
|
336
345
|
});
|
|
337
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* wrap step definition to enable retry ability
|
|
349
|
+
* @param {Function} code step definition
|
|
350
|
+
* @param {boolean} isStep
|
|
351
|
+
* @param {object} config
|
|
352
|
+
* @param {string} cid cid
|
|
353
|
+
* @param {StepDefinitionOptions} options
|
|
354
|
+
* @param {Function} getHookParams step definition
|
|
355
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
356
|
+
* @return {Function} wrapped step definition for sync WebdriverIO code
|
|
357
|
+
*/
|
|
358
|
+
wrapStep(code, isStep, config, cid, options, getHookParams, timeout, hookName = undefined) {
|
|
359
|
+
return function (...args) {
|
|
360
|
+
const hookParams = getHookParams();
|
|
361
|
+
const retryTest = isStep && isFinite(options.retry) ? options.retry : 0;
|
|
362
|
+
/**
|
|
363
|
+
* wrap user step/hook with wdio before/after hooks
|
|
364
|
+
*/
|
|
365
|
+
const beforeFn = config.beforeHook;
|
|
366
|
+
const afterFn = config.afterHook;
|
|
367
|
+
return testFnWrapper.call(this, isStep ? 'Step' : 'Hook', { specFn: code, specFnArgs: args }, { beforeFn: beforeFn, beforeFnArgs: (context) => [hookParams?.step, context] }, { afterFn: afterFn, afterFnArgs: (context) => [hookParams?.step, context] }, cid, retryTest, hookName, timeout);
|
|
368
|
+
};
|
|
369
|
+
}
|
|
338
370
|
}
|
|
339
371
|
/**
|
|
340
372
|
* Publishes a Cucumber report to a specified URL using NDJSON files from a directory.
|
package/build/types.d.ts
CHANGED
|
@@ -219,4 +219,10 @@ export interface HookFunctionExtension {
|
|
|
219
219
|
export interface StepDefinitionOptions {
|
|
220
220
|
retry: number;
|
|
221
221
|
}
|
|
222
|
+
export interface TestHookDefinitionConfig {
|
|
223
|
+
code: Function;
|
|
224
|
+
line: number;
|
|
225
|
+
options: any;
|
|
226
|
+
uri: string;
|
|
227
|
+
}
|
|
222
228
|
//# sourceMappingURL=types.d.ts.map
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3C;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC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AM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { supportCodeLibraryBuilder } from '@cucumber/cucumber';
|
|
1
2
|
import type { PickleStep, TestStep, Feature, Pickle, TestStepResultStatus } from '@cucumber/messages';
|
|
2
3
|
import type { Capabilities } from '@wdio/types';
|
|
3
4
|
import type { ReporterStep } from './types.js';
|
|
@@ -85,5 +86,11 @@ export declare function generateSkipTagsFromCapabilities(capabilities: Capabilit
|
|
|
85
86
|
* Retrives scenario description if available.
|
|
86
87
|
*/
|
|
87
88
|
export declare function getScenarioDescription(feature: Feature, scenarioId: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* wrap every user defined hook with function named `userHookFn`
|
|
91
|
+
* to identify later on is function a step, user hook or wdio hook.
|
|
92
|
+
* @param {object} options `Cucumber.supportCodeLibraryBuilder.options`
|
|
93
|
+
*/
|
|
94
|
+
export declare function setUserHookNames(options: typeof supportCodeLibraryBuilder): void;
|
|
88
95
|
export {};
|
|
89
96
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACvB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,
|
|
1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E,MAAM,CAAA;CAChB;;;;;;;;;;;;;UAPS,MAAM;;;;;EAqBnB;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAS3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,kBA4BvE;AAED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAAC,YAAY,EAAE,YAAY,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CA6CxH;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAG1E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,OAAO,yBAAyB,QAe1E"}
|
package/build/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import logger from '@wdio/logger';
|
|
3
|
+
import { isFunctionAsync } from '@wdio/utils';
|
|
4
|
+
import { CUCUMBER_HOOK_DEFINITION_TYPES } from './constants.js';
|
|
3
5
|
const log = logger('@wdio/cucumber-framework:utils');
|
|
4
6
|
/**
|
|
5
7
|
* NOTE: this function is exported for testing only
|
|
@@ -178,3 +180,24 @@ export function getScenarioDescription(feature, scenarioId) {
|
|
|
178
180
|
const children = feature.children?.find((child) => child?.scenario?.id === scenarioId);
|
|
179
181
|
return children?.scenario?.description || '';
|
|
180
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* wrap every user defined hook with function named `userHookFn`
|
|
185
|
+
* to identify later on is function a step, user hook or wdio hook.
|
|
186
|
+
* @param {object} options `Cucumber.supportCodeLibraryBuilder.options`
|
|
187
|
+
*/
|
|
188
|
+
export function setUserHookNames(options) {
|
|
189
|
+
CUCUMBER_HOOK_DEFINITION_TYPES.forEach(hookName => {
|
|
190
|
+
options[hookName].forEach((testRunHookDefinition) => {
|
|
191
|
+
const hookFn = testRunHookDefinition.code;
|
|
192
|
+
if (!hookFn.name.startsWith('wdioHook')) {
|
|
193
|
+
const userHookAsyncFn = async function (...args) {
|
|
194
|
+
return hookFn.apply(this, args);
|
|
195
|
+
};
|
|
196
|
+
const userHookFn = function (...args) {
|
|
197
|
+
return hookFn.apply(this, args);
|
|
198
|
+
};
|
|
199
|
+
testRunHookDefinition.code = (isFunctionAsync(hookFn)) ? userHookAsyncFn : userHookFn;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cucumber-framework",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.1",
|
|
4
4
|
"description": "A WebdriverIO plugin. Adapter for Cucumber.js testing framework.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cucumber-framework",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@cucumber/messages": "23.0.0",
|
|
44
44
|
"@types/node": "^20.1.0",
|
|
45
45
|
"@wdio/logger": "8.16.17",
|
|
46
|
-
"@wdio/types": "8.
|
|
47
|
-
"@wdio/utils": "8.
|
|
46
|
+
"@wdio/types": "8.23.1",
|
|
47
|
+
"@wdio/utils": "8.23.1",
|
|
48
48
|
"glob": "^10.2.2",
|
|
49
49
|
"got": "^13.0.0",
|
|
50
50
|
"is-glob": "^4.0.0"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "64633b802ba4d00d23f6531dadc3fc724d8d7dd5"
|
|
59
59
|
}
|