@wdio/cucumber-framework 8.10.0 → 8.10.2

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.
@@ -1,4 +1,4 @@
1
- declare const After: any, AfterAll: any, AfterStep: any, Before: any, BeforeAll: any, BeforeStep: any, DataTable: any, defineParameterType: any, defineStep: any, Given: any, setDefaultTimeout: any, setDefinitionFunctionWrapper: any, setWorldConstructor: any, World: any, Then: any, When: any;
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;
2
2
  declare const adapterFactory: {
3
3
  init: (...args: any[]) => Promise<import("../index.js").CucumberAdapter>;
4
4
  After: any;
@@ -7,15 +7,15 @@ declare const adapterFactory: {
7
7
  Before: any;
8
8
  BeforeAll: any;
9
9
  BeforeStep: any;
10
- DataTable: any;
10
+ Given: any;
11
+ Then: any;
12
+ When: any;
11
13
  defineParameterType: any;
12
14
  defineStep: any;
13
- Given: any;
14
15
  setDefaultTimeout: any;
15
16
  setDefinitionFunctionWrapper: any;
16
17
  setWorldConstructor: any;
18
+ DataTable: any;
17
19
  World: any;
18
- Then: any;
19
- When: 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,OACV,SAAS,OACT,mBAAmB,OACnB,UAAU,OACV,KAAK,OACL,iBAAiB,OACjB,4BAA4B,OAC5B,mBAAmB,OACnB,KAAK,OACL,IAAI,OACJ,IAAI,KACyB,CAAA;AAEjC,QAAA,MAAM,cAAc;oBACqC,GAAG,EAAE;;;;;;;;;;;;;;;;;CAuB7D,CAAA"}
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,5 +1,5 @@
1
1
  "use strict";
2
- const { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, DataTable, defineParameterType, defineStep, Given, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, World, Then, When } = require('@cucumber/cucumber');
2
+ const { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, Then, When, defineParameterType, defineStep, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, DataTable, World, } = require('@cucumber/cucumber');
3
3
  const adapterFactory = {
4
4
  init: async function initCucumberFramework(...args) {
5
5
  const { CucumberAdapter } = await import('../index.js');
@@ -8,21 +8,21 @@ const adapterFactory = {
8
8
  const instance = await adapter.init();
9
9
  return instance;
10
10
  },
11
- After: After,
12
- AfterAll: AfterAll,
13
- AfterStep: AfterStep,
14
- Before: Before,
15
- BeforeAll: BeforeAll,
16
- BeforeStep: BeforeStep,
17
- DataTable: DataTable,
18
- defineParameterType: defineParameterType,
19
- defineStep: defineStep,
20
- Given: Given,
21
- setDefaultTimeout: setDefaultTimeout,
22
- setDefinitionFunctionWrapper: setDefinitionFunctionWrapper,
23
- setWorldConstructor: setWorldConstructor,
24
- World: World,
25
- Then: Then,
26
- When: When,
11
+ After,
12
+ AfterAll,
13
+ AfterStep,
14
+ Before,
15
+ BeforeAll,
16
+ BeforeStep,
17
+ Given,
18
+ Then,
19
+ When,
20
+ defineParameterType,
21
+ defineStep,
22
+ setDefaultTimeout,
23
+ setDefinitionFunctionWrapper,
24
+ setWorldConstructor,
25
+ DataTable,
26
+ World,
27
27
  };
28
28
  module.exports = adapterFactory;
@@ -15,7 +15,7 @@ export default class CucumberEventListener extends EventEmitter {
15
15
  private _pickleMap;
16
16
  private _currentDoc;
17
17
  private _startedFeatures;
18
- constructor(eventBroadcaster: EventEmitter, _pickleFilter: PickleFilter);
18
+ constructor(eventBroadcaster: EventEmitter, _pickleFilter: InstanceType<typeof PickleFilter>);
19
19
  usesSpecGrouping(): boolean;
20
20
  featureIsStarted(feature: string): boolean;
21
21
  onGherkinDocument(gherkinDocEvent: GherkinDocument): void;
@@ -1 +1 @@
1
- {"version":3,"file":"cucumberEventListener.d.ts","sourceRoot":"","sources":["../src/cucumberEventListener.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EACR,MAAM,EAAE,QAAQ,EAAY,cAAc,EAAE,eAAe,EAAE,eAAe,EAC5E,eAAe,EAAE,gBAAgB,EACpC,MAAM,oBAAoB,CAAA;AAG3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAI/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,YAAY;IAWd,OAAO,CAAC,aAAa;IAVlE,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,O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AAiB;IACxC,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,WAAW,CAAoC;IACvD,OAAO,CAAC,gBAAgB,CAAe;gBAE1B,gBAAgB,EAAE,YAAY,EAAU,aAAa,EAAE,YAAY,CAAC,OAAO,YAAY,CAAC;IAuCrG,gBAAgB;IAIhB,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAoDhC,iBAAiB,CAAE,eAAe,EAAE,eAAe;IAgCnD,gBAAgB,CAAE,WAAW,EAAE,MAAM;IAgBrC,gBAAgB;IA4EhB,kBAAkB,CAAE,QAAQ,EAAE,QAAQ;IAetC,iBAAiB,CAAE,QAAQ,EAAE,eAAe;IAkD5C,iBAAiB,CAAE,oBAAoB,EAAE,eAAe;IAoCxD,kBAAkB,CAAE,qBAAqB,EAAE,gBAAgB;IA6B3D,kBAAkB,CACd,OAAO,EAAE,cAAc,EAAE;IA4B7B,iBAAiB;IAkBjB,aAAa;IAIb;;;OAGG;IACH,YAAY,CAAE,IAAI,EAAE,YAAY,CAAC,gBAAgB;CAgBpD"}
package/build/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'node:events';
3
3
  import * as Cucumber from '@cucumber/cucumber';
4
- import { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, DataTable, defineParameterType, defineStep, Given, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, World, Then, When } from '@cucumber/cucumber';
4
+ import type { World as WorldType } from '@cucumber/cucumber';
5
+ import type { GherkinDocument } from '@cucumber/messages';
5
6
  import type { Capabilities, Options } from '@wdio/types';
6
7
  import type { CucumberOptions, StepDefinitionOptions, HookFunctionExtension as HookFunctionExtensionImport } from './types.js';
8
+ declare const After: (<WorldType_1 = Cucumber.IWorld<any>>(code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_1 = Cucumber.IWorld<any>>(tags: string, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = Cucumber.IWorld<any>>(options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestCaseHookOptions, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_2>) => void), AfterAll: ((code: Function) => void) & ((options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestRunHookOptions, code: Function) => void), AfterStep: (<WorldType_1 = Cucumber.IWorld<any>>(code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_1 = Cucumber.IWorld<any>>(tags: string, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = Cucumber.IWorld<any>>(options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestStepHookOptions, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_2>) => void), Before: (<WorldType_1 = Cucumber.IWorld<any>>(code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_1 = Cucumber.IWorld<any>>(tags: string, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_1>) => void) & (<WorldType_2 = Cucumber.IWorld<any>>(options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestCaseHookOptions, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestCaseHookFunction<WorldType_2>) => void), BeforeAll: ((code: Function) => void) & ((options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestRunHookOptions, code: Function) => void), BeforeStep: (<WorldType_1 = Cucumber.IWorld<any>>(code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_1 = Cucumber.IWorld<any>>(tags: string, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = Cucumber.IWorld<any>>(options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineTestStepHookOptions, code: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").TestStepHookFunction<WorldType_2>) => void), Given: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineStep, Then: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineStep, When: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineStep, DataTable: typeof Cucumber.DataTable, World: typeof Cucumber.World, setDefaultTimeout: (milliseconds: number) => void, setDefinitionFunctionWrapper: (fn: Function) => void, setWorldConstructor: (fn: any) => void, defineParameterType: (options: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IParameterTypeDefinition<any>) => void, defineStep: import("@cucumber/cucumber/lib/support_code_library_builder/types.js").IDefineStep;
7
9
  declare class CucumberAdapter {
8
10
  private _cid;
9
11
  private _config;
@@ -21,6 +23,9 @@ declare class CucumberAdapter {
21
23
  private _pickleFilter;
22
24
  private getHookParams?;
23
25
  constructor(_cid: string, _config: Options.Testrunner, _specs: string[], _capabilities: Capabilities.RemoteCapability, _reporter: EventEmitter);
26
+ readFiles(filePaths?: Options.Testrunner['specs']): (string | string[])[];
27
+ getGherkinDocuments(files?: Options.Testrunner['specs']): (GherkinDocument | GherkinDocument[])[];
28
+ filterSpecsByTagExpression(specs?: Options.Testrunner['specs'], tagExpression?: string): typeof specs;
24
29
  init(): Promise<this>;
25
30
  hasTests(): boolean;
26
31
  run(): Promise<number>;
@@ -56,7 +61,7 @@ declare class CucumberAdapter {
56
61
  * @param {Function} getHookParams step definition
57
62
  * @return {Function} wrapped step definition for sync WebdriverIO code
58
63
  */
59
- wrapStep(code: Function, isStep: boolean, config: Options.Testrunner, cid: string, options: StepDefinitionOptions, getHookParams: Function): (this: Cucumber.World, ...args: any[]) => Promise<unknown>;
64
+ wrapStep(code: Function, isStep: boolean, config: Options.Testrunner, cid: string, options: StepDefinitionOptions, getHookParams: Function): (this: WorldType, ...args: any[]) => Promise<unknown>;
60
65
  }
61
66
  declare const adapterFactory: {
62
67
  init?: Function;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EACH,KAAK,EACL,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,EACT,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,mBAAmB,EACnB,KAAK,EACL,IAAI,EACJ,IAAI,EACP,MAAM,oBAAoB,CAAA;AAM3B,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAc,MAAM,aAAa,CAAA;AAKpE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,IAAI,2BAA2B,EAAE,MAAM,YAAY,CAAA;AAgB9H,cAAM,eAAe;IAab,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,SAAS;IAhBrB,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,gCAAgC,CAAU;IAClD,OAAO,CAAC,iBAAiB,CAAc;IACvC,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,aAAa,CAAC,CAAU;gBAGpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAA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,25 +1,35 @@
1
1
  import url from 'node:url';
2
2
  import path from 'node:path';
3
+ import fs from 'node:fs';
3
4
  import { createRequire } from 'node:module';
4
5
  import { EventEmitter } from 'node:events';
5
6
  import mockery from 'mockery';
6
7
  import isGlob from 'is-glob';
7
8
  import { sync as globSync } from 'glob';
9
+ import { executeHooksWithArgs, testFnWrapper } from '@wdio/utils';
8
10
  import * as Cucumber from '@cucumber/cucumber';
9
- import { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, DataTable, defineParameterType, defineStep, Given, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, World, Then, When } from '@cucumber/cucumber';
11
+ import Gherkin from '@cucumber/gherkin';
10
12
  import { GherkinStreams } from '@cucumber/gherkin-streams';
11
13
  import { IdGenerator } from '@cucumber/messages';
12
- import { executeHooksWithArgs, testFnWrapper } from '@wdio/utils';
14
+ import TagExpressionParser from '@cucumber/tag-expressions';
13
15
  import CucumberReporter from './reporter.js';
14
16
  import { DEFAULT_OPTS } from './constants.js';
15
- import { setUserHookNames } from './utils.js';
17
+ import { setUserHookNames, shouldRun } from './utils.js';
18
+ const { After, AfterAll, AfterStep, Before, BeforeAll, BeforeStep, Given, Then, When, DataTable, World, PickleFilter, Runtime, Status, setDefaultTimeout, setDefinitionFunctionWrapper, setWorldConstructor, defineParameterType, defineStep, parseGherkinMessageStream, supportCodeLibraryBuilder, } = Cucumber;
19
+ const uuidFn = IdGenerator.uuid();
20
+ const builder = new Gherkin.AstBuilder(uuidFn);
21
+ const matcher = new Gherkin.GherkinClassicTokenMatcher();
22
+ const gherkinParser = new Gherkin.Parser(builder, matcher);
16
23
  const require = createRequire(import.meta.url);
24
+ // EventDataCollector is not exported from main package
25
+ // Cannot import from path mapping without require
26
+ // See https://github.com/TypeStrong/ts-node/pull/1585
17
27
  const EventDataCollector = require('@cucumber/cucumber/lib/formatter/helpers/event_data_collector').default;
18
28
  const FILE_PROTOCOL = 'file://';
19
29
  const { incrementing } = IdGenerator;
20
30
  function getResultObject(world) {
21
31
  return {
22
- passed: (world.result?.status === Cucumber.Status.PASSED || world.result?.status === Cucumber.Status.SKIPPED),
32
+ passed: (world.result?.status === Status.PASSED || world.result?.status === Status.SKIPPED),
23
33
  error: world.result?.message,
24
34
  duration: world.result?.duration?.nanos / 1e6 // convert into ms
25
35
  };
@@ -68,7 +78,7 @@ class CucumberAdapter {
68
78
  const featurePathsToRun = this._cucumberFeaturesWithLineNumbers.length > 0
69
79
  ? this._cucumberFeaturesWithLineNumbers
70
80
  : this._specs;
71
- this._pickleFilter = new Cucumber.PickleFilter({
81
+ this._pickleFilter = new PickleFilter({
72
82
  cwd: this._cwd,
73
83
  featurePaths: featurePathsToRun,
74
84
  names: this._cucumberOpts.names,
@@ -83,13 +93,63 @@ class CucumberAdapter {
83
93
  };
84
94
  this._cucumberReporter = new CucumberReporter(this._eventBroadcaster, this._pickleFilter, reporterOptions, this._cid, this._specs, this._reporter);
85
95
  }
96
+ readFiles(filePaths = []) {
97
+ return filePaths.map(filePath => {
98
+ return Array.isArray(filePath)
99
+ ? filePath.map(file => fs.readFileSync(path.resolve(file), 'utf8'))
100
+ : fs.readFileSync(path.resolve(filePath), 'utf8');
101
+ });
102
+ }
103
+ getGherkinDocuments(files = []) {
104
+ return this.readFiles(files).map((specContent, idx) => {
105
+ const docs = [specContent]
106
+ .flat(1)
107
+ .map((content, ctIdx) => ({
108
+ ...gherkinParser.parse(content),
109
+ uri: Array.isArray(specContent)
110
+ ? files[idx][ctIdx]
111
+ : files[idx],
112
+ }));
113
+ const [doc, ...etc] = docs;
114
+ return etc.length ? docs : doc;
115
+ });
116
+ }
117
+ filterSpecsByTagExpression(specs = [], tagExpression = this._config.cucumberOpts?.tagExpression ?? '') {
118
+ if (!tagExpression) {
119
+ return specs;
120
+ }
121
+ const tagParser = TagExpressionParser(tagExpression);
122
+ const filteredSpecs = this
123
+ .getGherkinDocuments([this._specs])
124
+ .map((specDoc) => {
125
+ const [doc, ...etc] = [specDoc].flat(1).filter(doc => shouldRun(doc, tagParser));
126
+ const ret = Array.isArray(specDoc)
127
+ // Return group only if its not empty
128
+ ? doc && [doc, ...etc]
129
+ : doc;
130
+ return ret;
131
+ })
132
+ .filter((doc) => !!doc)
133
+ .map(doc => {
134
+ // Get URIs from Gherkin documents to run
135
+ const [uri, ...etc] = [doc].flat(1).map(doc => doc.uri);
136
+ return Array.isArray(doc) ? [uri, ...etc] : uri;
137
+ });
138
+ return filteredSpecs;
139
+ }
86
140
  async init() {
87
141
  try {
142
+ // Filter the specs according to the tag expression
143
+ // Some workers would only spawn to then skip the spec (Feature) file
144
+ // Filtering at this stage can prevent the spawning of a massive number of workers
145
+ if (this._config.cucumberOpts?.tagExpression) {
146
+ this._specs = this.filterSpecsByTagExpression([this._specs]).flat(1);
147
+ }
88
148
  const gherkinMessageStream = GherkinStreams.fromPaths(this._specs, {
89
149
  defaultDialect: this._cucumberOpts.featureDefaultLanguage,
90
150
  newId: this._newId
91
151
  });
92
- await Cucumber.parseGherkinMessageStream({
152
+ await parseGherkinMessageStream({
93
153
  cwd: this._cwd,
94
154
  eventBroadcaster: this._eventBroadcaster,
95
155
  gherkinMessageStream,
@@ -113,7 +173,7 @@ class CucumberAdapter {
113
173
  let result;
114
174
  try {
115
175
  await this.registerRequiredModules();
116
- Cucumber.supportCodeLibraryBuilder.reset(this._cwd, this._newId);
176
+ supportCodeLibraryBuilder.reset(this._cwd, this._newId);
117
177
  /**
118
178
  * wdio hooks should be added before spec files are loaded
119
179
  */
@@ -124,9 +184,9 @@ class CucumberAdapter {
124
184
  * we need to somehow identify is function is step or hook
125
185
  * so we wrap every user hook function
126
186
  */
127
- setUserHookNames(Cucumber.supportCodeLibraryBuilder);
128
- Cucumber.setDefaultTimeout(this._cucumberOpts.timeout);
129
- const supportCodeLibrary = Cucumber.supportCodeLibraryBuilder.finalize();
187
+ setUserHookNames(supportCodeLibraryBuilder);
188
+ setDefaultTimeout(this._cucumberOpts.timeout);
189
+ const supportCodeLibrary = supportCodeLibraryBuilder.finalize();
130
190
  /**
131
191
  * gets current step data: `{ uri, feature, scenario, step, sourceLocation }`
132
192
  * or `null` for some hooks.
@@ -135,7 +195,7 @@ class CucumberAdapter {
135
195
  .eventListener
136
196
  .getHookParams
137
197
  .bind(this._cucumberReporter.eventListener);
138
- const runtime = new Cucumber.Runtime({
198
+ const runtime = new Runtime({
139
199
  newId: this._newId,
140
200
  eventBroadcaster: this._eventBroadcaster,
141
201
  options: this._cucumberOpts,
@@ -224,25 +284,25 @@ class CucumberAdapter {
224
284
  */
225
285
  addWdioHooks(config) {
226
286
  const eventListener = this._cucumberReporter?.eventListener;
227
- Cucumber.BeforeAll(async function wdioHookBeforeFeature() {
287
+ BeforeAll(async function wdioHookBeforeFeature() {
228
288
  const params = eventListener?.getHookParams();
229
289
  await executeHooksWithArgs('beforeFeature', config.beforeFeature, [params?.uri, params?.feature]);
230
290
  });
231
- Cucumber.AfterAll(async function wdioHookAfterFeature() {
291
+ AfterAll(async function wdioHookAfterFeature() {
232
292
  const params = eventListener?.getHookParams();
233
293
  await executeHooksWithArgs('afterFeature', config.afterFeature, [params?.uri, params?.feature]);
234
294
  });
235
- Cucumber.Before(async function wdioHookBeforeScenario(world) {
295
+ Before(async function wdioHookBeforeScenario(world) {
236
296
  await executeHooksWithArgs('beforeScenario', config.beforeScenario, [world, this]);
237
297
  });
238
- Cucumber.After(async function wdioHookAfterScenario(world) {
298
+ After(async function wdioHookAfterScenario(world) {
239
299
  await executeHooksWithArgs('afterScenario', config.afterScenario, [world, getResultObject(world), this]);
240
300
  });
241
- Cucumber.BeforeStep(async function wdioHookBeforeStep() {
301
+ BeforeStep(async function wdioHookBeforeStep() {
242
302
  const params = eventListener?.getHookParams();
243
303
  await executeHooksWithArgs('beforeStep', config.beforeStep, [params?.step, params?.scenario, this]);
244
304
  });
245
- Cucumber.AfterStep(async function wdioHookAfterStep(world) {
305
+ AfterStep(async function wdioHookAfterStep(world) {
246
306
  const params = eventListener?.getHookParams();
247
307
  await executeHooksWithArgs('afterStep', config.afterStep, [params?.step, params?.scenario, getResultObject(world), this]);
248
308
  });
@@ -255,7 +315,7 @@ class CucumberAdapter {
255
315
  const wrapStep = this.wrapStep;
256
316
  const cid = this._cid;
257
317
  const getHookParams = () => this.getHookParams && this.getHookParams();
258
- Cucumber.setDefinitionFunctionWrapper((fn, options = { retry: 0 }) => {
318
+ setDefinitionFunctionWrapper((fn, options = { retry: 0 }) => {
259
319
  /**
260
320
  * hooks defined in wdio.conf are already wrapped
261
321
  */
@@ -17,7 +17,7 @@ export default class CucumberReporter {
17
17
  private _featureStart?;
18
18
  private _scenarioStart?;
19
19
  private _testStart?;
20
- constructor(eventBroadcaster: EventEmitter, pickleFilter: PickleFilter, _options: ReporterOptions, _cid: string, _specs: string[], _reporter: EventEmitter);
20
+ constructor(eventBroadcaster: EventEmitter, pickleFilter: InstanceType<typeof PickleFilter>, _options: ReporterOptions, _cid: string, _specs: string[], _reporter: EventEmitter);
21
21
  handleBeforeFeature(uri: string, feature: Feature): void;
22
22
  handleBeforeScenario(uri: string, feature: Feature, scenario: ReporterScenario): void;
23
23
  handleBeforeStep(uri: string, feature: Feature, scenario: Pickle, step: PickleStep | TestStep): void;
@@ -1 +1 @@
1
- {"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAoC,MAAM,oBAAoB,CAAA;AAEjI,OAAO,qBAAqB,MAAM,4BAA4B,CAAA;AAE9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,CAAC,OAAO,OAAO,g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E,YAAY;IAkBnC,mBAAmB,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAclD,oBAAoB,CAChB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,gBAAgB;IAgB9B,gBAAgB,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GAAG,QAAQ;IAS/B,eAAe,CACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,GAAG,QAAQ,EAC3B,MAAM,EAAE,cAAc;IAS1B,SAAS,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,cAAc;IAkB1B,SAAS,CACL,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,cAAc;IA+F1B,mBAAmB,CACf,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,cAAc;IAiB1B,kBAAkB,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAWjD,IAAI,CAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAUjC,QAAQ,CAAE,iBAAiB,EAAE,OAAO,GAAG,MAAM;CAQhD"}
package/build/utils.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import type TagExpressionParser from '@cucumber/tag-expressions';
1
2
  import type { supportCodeLibraryBuilder } from '@cucumber/cucumber';
2
- import type { PickleStep, TestStep, Feature, Pickle, TestStepResultStatus } from '@cucumber/messages';
3
+ import type { PickleStep, TestStep, Feature, Pickle, TestStepResultStatus, GherkinDocument, FeatureChild, RuleChild } from '@cucumber/messages';
3
4
  import type { Capabilities } from '@wdio/types';
4
5
  import type { ReporterStep } from './constants.js';
5
6
  /**
@@ -87,5 +88,10 @@ export declare function getRule(feature: Feature, scenarioId: string): string |
87
88
  * This will aad them
88
89
  */
89
90
  export declare function addKeywordToStep(steps: ReporterStep[], feature: Feature): ReporterStep[];
91
+ export declare function hasTags(msg: GherkinDocument | FeatureChild | RuleChild, { tagParser, lineOnFile }: {
92
+ tagParser: ReturnType<typeof TagExpressionParser>;
93
+ lineOnFile: number | undefined;
94
+ }): boolean;
95
+ export declare function shouldRun(doc: GherkinDocument, tagParser: ReturnType<typeof TagExpressionParser>): boolean;
90
96
  export {};
91
97
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAEnE,OAAO,KAAK,EAAuB,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAG1H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAMlD;;GAEG;AACH,wBAAgB,kBAAkB,CAAE,EAAE,QAAQ,EAAE,EAAE,UAAU;;;;cAoB3D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAE,EAAE,OAAY,EAAE,EAAE,GAAG,OAgBnD;AAED,aAAK,QAAQ;IACT,IAAI,SAAS;IACb,IAAI,SAAS;CAChB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAE,IAAI,EAAE,QAAQ,YAE1C;AAED,wBAAgB,YAAY,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,UAE1D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAE,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AC,EAAE,MAAM,WA+B1F;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,wBAAgB,OAAO,CACnB,GAAG,EAAE,eAAe,GAAG,YAAY,GAAG,SAAS,EAC/C,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE;IAAE,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,WAiBnH;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,WA6BhG"}
package/build/utils.js CHANGED
@@ -135,7 +135,7 @@ export function filterPickles(capabilities, pickle) {
135
135
  return !(pickle && pickle.tags && pickle.tags
136
136
  .map(p => p.name?.match(skipTag))
137
137
  .filter(Boolean)
138
- .map(m => parse(m[1]))
138
+ .map(m => parse(m[1] ?? ''))
139
139
  .find((filter) => Object.keys(filter)
140
140
  .every((key) => match(capabilities[key], filter[key]))));
141
141
  }
@@ -185,3 +185,38 @@ export function addKeywordToStep(steps, feature) {
185
185
  return step;
186
186
  });
187
187
  }
188
+ export function hasTags(msg, { tagParser, lineOnFile }) {
189
+ const type = (msg.feature
190
+ ?? msg.rule
191
+ ?? msg.scenario);
192
+ if (type) {
193
+ const matches = tagParser.evaluate(type.tags.map(t => t.name));
194
+ return lineOnFile
195
+ // Evaluate only specific line
196
+ ? type.location.line === lineOnFile && matches
197
+ : matches;
198
+ }
199
+ return false;
200
+ }
201
+ export function shouldRun(doc, tagParser) {
202
+ if (!doc.feature) {
203
+ return false;
204
+ }
205
+ const ext = path.extname(doc.uri);
206
+ const lineOnFile = ext.startsWith('feature:')
207
+ ? Number(ext.split('feature:').pop())
208
+ : undefined;
209
+ return (
210
+ // Check if Feature has matching tags
211
+ hasTags(doc, { tagParser, lineOnFile })
212
+ // Check if some root Scenarios have matching tags
213
+ || doc.feature.children.filter(c => c.scenario).some(child => hasTags(child, { tagParser, lineOnFile }))
214
+ // Check if some Rules have matching tags
215
+ || doc.feature.children.filter(c => c.rule).some(child => hasTags(child, { tagParser, lineOnFile }))
216
+ // Check if some Scenarios within Rules have matching tags
217
+ || doc.feature.children
218
+ .filter(c => c.rule)
219
+ .map(c => c.rule.children.filter(c => c.scenario))
220
+ .flat(1)
221
+ .some(child => hasTags(child, { tagParser, lineOnFile })));
222
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/cucumber-framework",
3
- "version": "8.10.0",
3
+ "version": "8.10.2",
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",
@@ -38,14 +38,15 @@
38
38
  "types": "./build/index.d.ts",
39
39
  "typeScriptVersion": "3.8.3",
40
40
  "dependencies": {
41
- "@cucumber/cucumber": "8.5.3",
41
+ "@cucumber/cucumber": "8.11.1",
42
42
  "@cucumber/gherkin": "26.2.0",
43
- "@cucumber/gherkin-streams": "^5.0.0",
43
+ "@cucumber/gherkin-streams": "^5.0.1",
44
44
  "@cucumber/messages": "22.0.0",
45
- "@types/node": "^18.0.0",
45
+ "@cucumber/tag-expressions": "5.0.1",
46
+ "@types/node": "^20.1.0",
46
47
  "@wdio/logger": "8.6.6",
47
- "@wdio/types": "8.10.0",
48
- "@wdio/utils": "8.10.0",
48
+ "@wdio/types": "8.10.2",
49
+ "@wdio/utils": "8.10.2",
49
50
  "glob": "^10.2.2",
50
51
  "is-glob": "^4.0.0",
51
52
  "mockery": "^2.1.0"
@@ -57,5 +58,5 @@
57
58
  "publishConfig": {
58
59
  "access": "public"
59
60
  },
60
- "gitHead": "f0c607340b4f31a4ae48509115335283f488e38f"
61
+ "gitHead": "fb163d506af31d0c5e5328bfee07d55a56aa0034"
61
62
  }