@wdio/cucumber-framework 8.15.10 → 8.16.0

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/README.md CHANGED
@@ -44,38 +44,18 @@ Type: `String[]`<br />
44
44
  Default: `[]`<br />
45
45
  Example: `['@babel/register']` or `[['@babel/register', { rootMode: 'upward', ignore: ['node_modules'] }]]`
46
46
 
47
- ### failAmbiguousDefinitions
48
- **Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself**
49
- Treat ambiguous definitions as errors.
50
-
51
- Type: `Boolean`<br />
52
- Default: `false`
53
-
54
47
  ### failFast
55
48
  Abort the run on first failure.
56
49
 
57
50
  Type: `Boolean`<br />
58
51
  Default: `false`
59
52
 
60
- ### ignoreUndefinedDefinitions
61
- **Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself**
62
- Treat undefined definitions as warnings.
63
-
64
- Type: `Boolean`<br />
65
- Default: `false`
66
-
67
53
  ### name
68
54
  Only execute the scenarios with name matching the expression (repeatable).
69
55
 
70
56
  Type: `REGEXP[]`<br />
71
57
  Default: `[]`
72
58
 
73
- ### profile
74
- Specify the profile to use.
75
-
76
- Type: `String[]`<br />
77
- Default: `[]`
78
-
79
59
  ### require
80
60
  Require files containing your step definitions before executing features. You can also specify a glob to your step definitions.
81
61
 
@@ -83,23 +63,12 @@ Type: `String[]`<br />
83
63
  Default: `[]`<br />
84
64
  Example: `[path.join(__dirname, 'step-definitions', 'my-steps.js')]`
85
65
 
86
- ### snippetSyntax
87
- Specify a custom snippet syntax.
88
-
89
- Type: `String`<br />
90
- Default: `undefined`
91
-
92
- ### snippets
93
- Hide step definition snippets for pending steps.
94
-
95
- Type: `Boolean`<br />
96
- Default: `true`
97
-
98
- ### source
99
- Hide source uris.
66
+ ### import
67
+ Paths to where your support code is, for ESM.
100
68
 
101
- Type: `Boolean`<br />
102
- Default: `true`
69
+ Type: `String[]`<br />
70
+ Default: `[]`<br />
71
+ Example: `[path.join(__dirname, 'step-definitions', 'my-steps.js')]`
103
72
 
104
73
  ### strict
105
74
  Fail if there are any undefined or pending steps
@@ -107,23 +76,17 @@ Fail if there are any undefined or pending steps
107
76
  Type: `Boolean`<br />
108
77
  Default: `false`
109
78
 
110
- ### tagExpression
79
+ ### tags
111
80
  Only execute the features or scenarios with tags matching the expression. Note that untagged
112
81
  features will still spawn a Selenium session (see issue [webdriverio/webdriverio#1247](https://github.com/webdriverio/webdriverio/issues/1247)).
113
82
  Please see the [Cucumber documentation](https://docs.cucumber.io/cucumber/api/#tag-expressions) for more details.
114
83
  If passing as a command-line argument, compound expressions may need to be enclosed in three sets of double quotes if WebdriverIO is invoked using `npx` on Windows.
115
84
 
116
- E.g.: `npx wdio wdio.config.js --cucumberOpts.tagExpression """@Smoke and not @Pending"""`
85
+ E.g.: `npx wdio wdio.config.js --cucumberOpts.tags """@Smoke and not @Pending"""`
117
86
 
118
87
  Type: `String`<br />
119
88
  Default: ``
120
89
 
121
- ### tagsInTitle
122
- Add cucumber tags to feature or scenario name
123
-
124
- Type: `Boolean`<br />
125
- Default: `false`
126
-
127
90
  ### timeout
128
91
  Timeout in milliseconds for step definitions.
129
92
 
@@ -141,6 +104,50 @@ Only retries the features or scenarios with tags matching the expression (repeat
141
104
 
142
105
  Type: `RegExp`
143
106
 
107
+ ### tagsInTitle
108
+ Add cucumber tags to feature or scenario name
109
+
110
+ Type: `Boolean`<br />
111
+ Default: `false`
112
+
113
+ ***Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself***<br/>
114
+
115
+ ### ignoreUndefinedDefinitions
116
+ Treat undefined definitions as warnings.
117
+
118
+ Type: `Boolean`<br />
119
+ Default: `false`
120
+
121
+ ***Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself***<br/>
122
+
123
+ ### failAmbiguousDefinitions
124
+ Treat ambiguous definitions as errors.
125
+
126
+ Type: `Boolean`<br />
127
+ Default: `false`
128
+
129
+ ***Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself***<br/>
130
+
131
+ ### tagExpression
132
+ Only execute the features or scenarios with tags matching the expression. Note that untagged
133
+ features will still spawn a Selenium session (see issue [webdriverio/webdriverio#1247](https://github.com/webdriverio/webdriverio/issues/1247)).
134
+ Please see the [Cucumber documentation](https://docs.cucumber.io/cucumber/api/#tag-expressions) for more details.
135
+ If passing as a command-line argument, compound expressions may need to be enclosed in three sets of double quotes if WebdriverIO is invoked using `npx` on Windows.
136
+
137
+ E.g.: `npx wdio wdio.config.js --cucumberOpts.tagExpression """@Smoke and not @Pending"""`
138
+
139
+ Type: `String`<br />
140
+ Default: ``
141
+
142
+ ***Please note that this option would be deprecated in future. Use [`tags`](#tags) config property instead***
143
+
144
+ #### profile
145
+ Specify the profile to use.
146
+
147
+ Type: `string[]`<br />
148
+ Default: `[]`
149
+
150
+ ***Kindly take note that only specific values (worldParameters, name, retryTagFilter) are supported within profiles, as `cucumberOpts` takes precedence. Additionally, when using a profile, make sure that the mentioned values are not declared within `cucumberOpts`.***
144
151
  ----
145
152
 
146
153
  For more information on WebdriverIO see the [homepage](http://webdriver.io).
@@ -1,4 +1,4 @@
1
- declare const After: any, AfterAll: any, AfterStep: any, Before: any, BeforeAll: any, BeforeStep: any, Given: any, Then: any, When: any, defineParameterType: any, defineStep: any, setDefaultTimeout: any, setDefinitionFunctionWrapper: any, setWorldConstructor: any, DataTable: any, World: any;
1
+ declare const After: any, AfterAll: any, AfterStep: any, Before: any, BeforeAll: any, BeforeStep: any, Given: any, When: any, Then: any, DataTable: any, World: any, setDefaultTimeout: any, setDefinitionFunctionWrapper: any, setWorldConstructor: any, defineParameterType: any, defineStep: any;
2
2
  declare const adapterFactory: {
3
3
  init: (...args: any[]) => Promise<import("../index.js").CucumberAdapter>;
4
4
  After: any;
@@ -8,14 +8,14 @@ declare const adapterFactory: {
8
8
  BeforeAll: any;
9
9
  BeforeStep: any;
10
10
  Given: any;
11
- Then: any;
12
11
  When: any;
13
- defineParameterType: any;
14
- defineStep: any;
12
+ Then: any;
13
+ DataTable: any;
14
+ World: any;
15
15
  setDefaultTimeout: any;
16
16
  setDefinitionFunctionWrapper: any;
17
17
  setWorldConstructor: any;
18
- DataTable: any;
19
- World: any;
18
+ defineParameterType: any;
19
+ defineStep: any;
20
20
  };
21
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cjs/index.ts"],"names":[],"mappings":"AAAA,QAAA,MACI,KAAK,OACL,QAAQ,OACR,SAAS,OACT,MAAM,OACN,SAAS,OACT,UAAU,OAEV,KAAK,OACL,IAAI,OACJ,IAAI,OAEJ,mBAAmB,OACnB,UAAU,OACV,iBAAiB,OACjB,4BAA4B,OAC5B,mBAAmB,OAEnB,SAAS,OACT,KAAK,KACwB,CAAA;AAEjC,QAAA,MAAM,cAAc;oBACqC,GAAG,EAAE;;;;;;;;;;;;;;;;;CA0B7D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cjs/index.ts"],"names":[],"mappings":"AAAA,QAAA,MACI,KAAK,OACL,QAAQ,OACR,SAAS,OAET,MAAM,OACN,SAAS,OACT,UAAU,OAEV,KAAK,OACL,IAAI,OACJ,IAAI,OAEJ,SAAS,OAET,KAAK,OAEL,iBAAiB,OACjB,4BAA4B,OAC5B,mBAAmB,OACnB,mBAAmB,OACnB,UAAU,KAEmB,CAAA;AAEjC,QAAA,MAAM,cAAc;oBACqC,GAAG,EAAE;;;;;;;;;;;;;;;;;CA4B7D,CAAA"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, Then, When, defineParameterType, defineStep, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, DataTable, World, } = require('@cucumber/cucumber');
2
+ const { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, When, Then, DataTable, World, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, defineParameterType, defineStep } = require('@cucumber/cucumber');
3
3
  const adapterFactory = {
4
4
  init: async function initCucumberFramework(...args) {
5
5
  const { CucumberAdapter } = await import('../index.js');
@@ -15,14 +15,14 @@ const adapterFactory = {
15
15
  BeforeAll,
16
16
  BeforeStep,
17
17
  Given,
18
- Then,
19
18
  When,
20
- defineParameterType,
21
- defineStep,
19
+ Then,
20
+ DataTable,
21
+ World,
22
22
  setDefaultTimeout,
23
23
  setDefinitionFunctionWrapper,
24
24
  setWorldConstructor,
25
- DataTable,
26
- World,
25
+ defineParameterType,
26
+ defineStep
27
27
  };
28
28
  module.exports = adapterFactory;
@@ -1,21 +1,5 @@
1
- import type { Pickle, PickleStep } from '@cucumber/messages';
2
1
  import type { CucumberOptions } from './types.js';
3
2
  export declare const DEFAULT_TIMEOUT = 60000;
3
+ export declare const FILE_PROTOCOL = "file://";
4
4
  export declare const DEFAULT_OPTS: CucumberOptions;
5
- export declare const NOOP: () => void;
6
- export declare const CUCUMBER_HOOK_DEFINITION_TYPES: readonly ["beforeTestRunHookDefinitionConfigs", "beforeTestCaseHookDefinitionConfigs", "afterTestCaseHookDefinitionConfigs", "afterTestRunHookDefinitionConfigs"];
7
- /**
8
- * The pickle step needs to have a keyword for the reporters, otherwise reporters like
9
- * the allure or spec reporter won't show the `Given|When|Then` words
10
- */
11
- export interface ReporterStep extends PickleStep {
12
- keyword?: string;
13
- }
14
- /**
15
- * The pickle scenario needs to have a rule for the reporters, otherwise reporters like
16
- * the allure or spec reporter won't show the rule
17
- */
18
- export interface ReporterScenario extends Pickle {
19
- rule?: string;
20
- }
21
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,YAAY,EAAE,eAkB1B,CAAA;AAGD,eAAO,MAAM,IAAI,YAAiB,CAAA;AAElC,eAAO,MAAM,8BAA8B,mKAKjC,CAAA;AAEV;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,QAAQ,CAAA;AAEpC,eAAO,MAAM,aAAa,YAAY,CAAA;AAMtC,eAAO,MAAM,YAAY,EAAE,eA2B1B,CAAA"}
@@ -1,28 +1,34 @@
1
+ import url from 'node:url';
2
+ import path from 'node:path';
1
3
  export const DEFAULT_TIMEOUT = 60000;
4
+ export const FILE_PROTOCOL = 'file://';
5
+ const cucumberFormatter = path.resolve(url.fileURLToPath(import.meta.url), '../cucumberFormatter.js');
6
+ const isWindows = process.platform === 'win32';
2
7
  export const DEFAULT_OPTS = {
8
+ paths: [],
3
9
  backtrace: false,
4
- requireModule: [],
5
- failAmbiguousDefinitions: false,
10
+ dryRun: false,
11
+ forceExit: false,
6
12
  failFast: false,
7
- ignoreUndefinedDefinitions: false,
8
- names: [],
9
- require: [],
13
+ format: [isWindows ? `file://${cucumberFormatter}` : cucumberFormatter],
14
+ formatOptions: {},
15
+ import: [],
16
+ language: 'en',
17
+ name: [],
10
18
  order: 'defined',
11
- snippets: true,
12
- source: true,
19
+ parallel: 0,
20
+ publish: false,
21
+ require: [],
22
+ requireModule: [],
23
+ retry: 0,
13
24
  strict: false,
14
- tagExpression: '',
15
- tagsInTitle: false,
25
+ tags: '',
26
+ worldParameters: {},
16
27
  timeout: DEFAULT_TIMEOUT,
17
- retry: 0,
18
28
  scenarioLevelReporter: false,
19
- featureDefaultLanguage: 'en'
29
+ tagsInTitle: false,
30
+ ignoreUndefinedDefinitions: false,
31
+ failAmbiguousDefinitions: false,
32
+ tagExpression: '',
33
+ profiles: []
20
34
  };
21
- /* istanbul ignore next */
22
- export const NOOP = function () { };
23
- export const CUCUMBER_HOOK_DEFINITION_TYPES = [
24
- 'beforeTestRunHookDefinitionConfigs',
25
- 'beforeTestCaseHookDefinitionConfigs',
26
- 'afterTestCaseHookDefinitionConfigs',
27
- 'afterTestRunHookDefinitionConfigs',
28
- ];
@@ -0,0 +1,43 @@
1
+ import type { IFormatterOptions } from '@cucumber/cucumber';
2
+ import { Formatter } from '@cucumber/cucumber';
3
+ import type { GherkinDocument, Feature, Pickle, PickleStep, TestCase, TestCaseStarted, TestStep, TestStepStarted, TestStepFinished, TestStepResult } from '@cucumber/messages';
4
+ export default class CucumberFormatter extends Formatter {
5
+ private _gherkinDocEvents;
6
+ private _scenarios;
7
+ private _testCases;
8
+ private _currentTestCase?;
9
+ private _currentPickle?;
10
+ private _suiteMap;
11
+ private _pickleMap;
12
+ private _currentDoc;
13
+ private _startedFeatures;
14
+ private reporter;
15
+ private cid;
16
+ private specs;
17
+ private eventEmitter;
18
+ private scenarioLevelReporter;
19
+ private tagsInTitle;
20
+ private ignoreUndefinedDefinitions;
21
+ private failAmbiguousDefinitions;
22
+ private failedCount;
23
+ private _featureStart?;
24
+ private _scenarioStart?;
25
+ private _testStart?;
26
+ constructor(options: IFormatterOptions);
27
+ emit(event: string, payload: any): void;
28
+ usesSpecGrouping(): boolean;
29
+ featureIsStarted(feature: string): boolean;
30
+ getTitle(featureOrScenario: Feature | Pickle): string;
31
+ afterHook(uri: string, feature: Feature, scenario: Pickle, step: TestStep, result: TestStepResult): void;
32
+ afterTest(uri: string, feature: Feature, scenario: Pickle, step: PickleStep, result: TestStepResult): void;
33
+ onGherkinDocument(gherkinDocEvent: GherkinDocument): void;
34
+ onTestRunStarted(): void;
35
+ onPickleAccepted(pickleEvent: Pickle): void;
36
+ onTestCasePrepared(testCase: TestCase): void;
37
+ onTestCaseStarted(testcase: TestCaseStarted): void;
38
+ onTestStepStarted(testStepStartedEvent: TestStepStarted): void;
39
+ onTestStepFinished(testStepFinishedEvent: TestStepFinished): void;
40
+ onTestCaseFinished(results: TestStepResult[]): void;
41
+ onTestRunFinished(): void;
42
+ }
43
+ //# sourceMappingURL=cucumberFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cucumberFormatter.d.ts","sourceRoot":"","sources":["../src/cucumberFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAU,MAAM,oBAAoB,CAAA;AAOtD,OAAO,KAAK,EAER,eAAe,EAEf,OAAO,EACP,MAAM,EAEN,UAAU,EACV,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,cAAc,EAEjB,MAAM,oBAAoB,CAAA;AAa3B,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IACpD,OAAO,CAAC,iBAAiB,CAAwB;IACjD,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,UAAU,CAAiB;IACnC,OAAO,CAAC,gBAAgB,CAAC,CAAiB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,gBAAgB,CAAe;IAEvC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,GAAG,CAAQ;IACnB,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,YAAY,CAAc;IAClC,OAAO,CAAC,qBAAqB,CAAS;IACtC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,0BAA0B,CAAS;IAC3C,OAAO,CAAC,wBAAwB,CAAS;IAEzC,OAAO,CAAC,WAAW,CAAI;IAEvB,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,cAAc,CAAC,CAAM;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAM;gBAEb,OAAO,EAAE,iBAAiB;IA+CtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAUhC,gBAAgB;IAIhB,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAIhC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM;IAS5C,SAAS,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,cAAc;IAsB1B,SAAS,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,cAAc;IA6F1B,iBAAiB,CAAC,eAAe,EAAE,eAAe;IASlD,gBAAgB;IAsBhB,gBAAgB,CAAC,WAAW,EAAE,MAAM;IAQpC,kBAAkB,CAAC,QAAQ,EAAE,QAAQ;IAIrC,iBAAiB,CAAC,QAAQ,EAAE,eAAe;IA+F3C,iBAAiB,CAAC,oBAAoB,EAAE,eAAe;IA4CvD,kBAAkB,CAAC,qBAAqB,EAAE,gBAAgB;IAkD1D,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE;IAyC5C,iBAAiB;CA2CpB"}