@wdio/config 9.10.1 → 9.11.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.
@@ -16,6 +16,7 @@ interface MergeConfig extends Omit<Partial<TestrunnerOptionsWithParameters>, 'sp
16
16
  'wdio:specs'?: Spec[];
17
17
  exclude?: string[];
18
18
  'wdio:exclude'?: string[];
19
+ group?: boolean;
19
20
  }
20
21
  export default class ConfigParser {
21
22
  #private;
@@ -67,7 +68,7 @@ export default class ConfigParser {
67
68
  * cli argument
68
69
  * @return {String[]} List of files that should be included or excluded
69
70
  */
70
- setFilePathToFilterOptions(cliArgFileList: string[], specs: Spec[]): string[];
71
+ setFilePathToFilterOptions(cliArgFileList: string[], specs: Spec[], group?: boolean): string[];
71
72
  /**
72
73
  * return configs
73
74
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigParser.d.ts","sourceRoot":"","sources":["../../src/node/ConfigParser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAa,QAAQ,EAAE,MAAM,aAAa,CAAA;AAO7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAM9C,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAK7B,UAAU,+BAAgC,SAAQ,OAAO,CAAC,UAAU;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,YAAY,CAAC,sBAAsB,CAAA;IAClD,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,UAAU,WAAY,SAAQ,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC,EAAE,OAAO,G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tB;;;OAGG;IACK,cAAc,GAAE,OAAO,CAAC,+BAA+B,CAAM,EAC7D,YAAY,GAAE,WAAyC;IAmBnE;;OAEG;IACG,UAAU,CAAC,MAAM,GAAE,WAAgB;IAgCzC;;;OAGG;YACW,aAAa;IA2D3B;;;;OAIG;IACH,OAAO,CAAC,KAAK;IA4Eb;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK;IAkClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE;IA4D/C;;;;;;;;OAQG;IACH,0BAA0B,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO;IAgDnF;;OAEG;IACH,SAAS,IAIkB,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC;IAGvD;;OAEG;IACH,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC,sBAAsB,GAAG,YAAY,CAAC,+BAA+B;IAY/G;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,WAAyC,EAAE,cAAc,CAAC,EAAE,MAAM;IAkDtI;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE;IA2BhD,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE;CAWtB"}
@@ -1,3 +1,4 @@
1
1
  import ConfigParser from './ConfigParser.js';
2
- export { ConfigParser };
2
+ import FileSystemPathService from './FileSystemPathService.js';
3
+ export { ConfigParser, FileSystemPathService };
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EAAE,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAC5C,OAAO,qBAAqB,MAAM,4BAA4B,CAAA;AAE9D,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,CAAA"}
@@ -68,7 +68,7 @@ function makeRelativeToCWD(files = []) {
68
68
  continue;
69
69
  }
70
70
  returnFiles.push(
71
- file.startsWith("file:///") ? url2.fileURLToPath(file) : file.includes("/") ? path2.resolve(process.cwd(), file) : file
71
+ file.startsWith("file:///") ? url2.fileURLToPath(file) : file.includes("/") && !file.includes("*") ? path2.resolve(process.cwd(), file) : file
72
72
  );
73
73
  }
74
74
  return returnFiles;
@@ -325,7 +325,7 @@ var ConfigParser = class _ConfigParser {
325
325
  this._config.cucumberFeaturesWithLineNumbers = Array.isArray(this._config.spec) ? [...new Set(this._config.spec)] : [this._config.spec];
326
326
  }
327
327
  if (addPathToSpecs && spec.length > 0) {
328
- this._config.specs = this.setFilePathToFilterOptions(spec, this._config.specs);
328
+ this._config.specs = this.setFilePathToFilterOptions(spec, this._config.specs, object.group);
329
329
  }
330
330
  if (exclude.length > 0 && allKeywordsContainPath(exclude)) {
331
331
  this._config.exclude = this.setFilePathToFilterOptions(exclude, this._config.exclude);
@@ -396,7 +396,7 @@ var ConfigParser = class _ConfigParser {
396
396
  }
397
397
  specs = isSpecParamPassed ? [...specs, ...suiteSpecs] : suiteSpecs;
398
398
  }
399
- specs = [...new Set(specs)];
399
+ specs = filterDublicationArrayItems(specs);
400
400
  const hasSubsetOfSpecsDefined = isSpecParamPassed || suites.length > 0;
401
401
  if (repeat && hasSubsetOfSpecsDefined) {
402
402
  specs = Array.from({ length: repeat }, () => specs).flat();
@@ -416,13 +416,13 @@ var ConfigParser = class _ConfigParser {
416
416
  * cli argument
417
417
  * @return {String[]} List of files that should be included or excluded
418
418
  */
419
- setFilePathToFilterOptions(cliArgFileList, specs) {
419
+ setFilePathToFilterOptions(cliArgFileList, specs, group) {
420
420
  const filesToFilter = /* @__PURE__ */ new Set();
421
421
  const fileList = _ConfigParser.getFilePaths(specs, this._config.rootDir, this._pathService);
422
422
  cliArgFileList.forEach((filteredFile) => {
423
423
  filteredFile = removeLineNumbers(filteredFile);
424
424
  const globMatchedFiles = _ConfigParser.getFilePaths(
425
- this._pathService.glob(filteredFile, path3.dirname(this.#configFilePath)),
425
+ group ? [[filteredFile]] : [filteredFile],
426
426
  this._config.rootDir,
427
427
  this._pathService
428
428
  );
@@ -438,12 +438,12 @@ var ConfigParser = class _ConfigParser {
438
438
  } else {
439
439
  fileList.forEach((file) => {
440
440
  if (typeof file === "string") {
441
- if (file.match(filteredFile)) {
441
+ if (isValidRegex(filteredFile) && file.match(filteredFile)) {
442
442
  filesToFilter.add(file);
443
443
  }
444
444
  } else if (Array.isArray(file)) {
445
445
  file.forEach((subFile) => {
446
- if (subFile.match(filteredFile)) {
446
+ if (isValidRegex(filteredFile) && subFile.match(filteredFile)) {
447
447
  filesToFilter.add(subFile);
448
448
  }
449
449
  });
@@ -537,7 +537,7 @@ var ConfigParser = class _ConfigParser {
537
537
  */
538
538
  filterSpecs(specs, excludeList) {
539
539
  if (allKeywordsContainPath(excludeList)) {
540
- return specs.reduce((returnVal, currSpec) => {
540
+ const filteredSpec2 = specs.reduce((returnVal, currSpec) => {
541
541
  if (Array.isArray(currSpec)) {
542
542
  returnVal.push(currSpec.filter((specItem) => !excludeList.includes(specItem)));
543
543
  } else if (excludeList.indexOf(currSpec) === -1) {
@@ -545,8 +545,9 @@ var ConfigParser = class _ConfigParser {
545
545
  }
546
546
  return returnVal;
547
547
  }, []);
548
+ return filterEmptyArrayItems(filteredSpec2);
548
549
  }
549
- return specs.reduce((returnVal, currSpec) => {
550
+ const filteredSpec = specs.reduce((returnVal, currSpec) => {
550
551
  if (Array.isArray(currSpec)) {
551
552
  returnVal.push(currSpec.filter((specItem) => !excludeList.some((excludeVal) => specItem.includes(excludeVal))));
552
553
  }
@@ -556,6 +557,7 @@ var ConfigParser = class _ConfigParser {
556
557
  }
557
558
  return returnVal;
558
559
  }, []);
560
+ return filterEmptyArrayItems(filteredSpec);
559
561
  }
560
562
  shard(specs) {
561
563
  if (!this._config.shard || this._config.shard.total === 1) {
@@ -569,8 +571,23 @@ var ConfigParser = class _ConfigParser {
569
571
  }
570
572
  };
571
573
  function allKeywordsContainPath(excludedSpecList) {
572
- return excludedSpecList.every((val) => val.includes("/") || val.includes("\\"));
574
+ return excludedSpecList.every((val) => val.includes("/") || val.includes("\\") || val.includes("*"));
575
+ }
576
+ function filterEmptyArrayItems(specList) {
577
+ return specList.filter((item) => Array.isArray(item) && item.length || !Array.isArray(item));
578
+ }
579
+ function filterDublicationArrayItems(specList) {
580
+ return [...new Set(specList.map((item) => Array.isArray(item) ? [...new Set(item)] : item))];
581
+ }
582
+ function isValidRegex(expression) {
583
+ try {
584
+ new RegExp(expression);
585
+ return true;
586
+ } catch {
587
+ return false;
588
+ }
573
589
  }
574
590
  export {
575
- ConfigParser
591
+ ConfigParser,
592
+ FileSystemPathService
576
593
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/config",
3
- "version": "9.10.1",
3
+ "version": "9.11.0",
4
4
  "description": "A helper utility to parse and validate WebdriverIO options",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-config",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@wdio/logger": "9.4.4",
40
40
  "@wdio/types": "9.10.1",
41
- "@wdio/utils": "9.10.1",
41
+ "@wdio/utils": "9.11.0",
42
42
  "deepmerge-ts": "^7.0.3",
43
43
  "glob": "^10.2.2",
44
44
  "import-meta-resolve": "^4.0.0"
@@ -49,5 +49,5 @@
49
49
  "devDependencies": {
50
50
  "minimatch": "^9.0.0"
51
51
  },
52
- "gitHead": "dc41a90e711d7b7a10e8129fb74650ad7a5956d0"
52
+ "gitHead": "79a39e09a5eeabebac2f068b8d29f0ae4921fa20"
53
53
  }