@wdio/config 8.41.0 → 8.45.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.
@@ -15,6 +15,7 @@ interface MergeConfig extends Omit<Partial<TestrunnerOptionsWithParameters>, 'sp
15
15
  'wdio:specs'?: Spec[];
16
16
  exclude?: string[];
17
17
  'wdio:exclude'?: string[];
18
+ group?: boolean;
18
19
  }
19
20
  export default class ConfigParser {
20
21
  #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;AAQ7E,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAMnE,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAK7B,UAAU,+BAAgC,SAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;IACtF,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,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAAA;IAC9C,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,WAAY,SAAQ,IAAI,CAAC,OAAO,CAAC,+BAA+B,CAAC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AC,aAAa,CAAsC;gBAGvD,cAAc,EAAE,MAAM;IACtB;;;OAGG;IACK,cAAc,GAAE,OAAO,CAAC,+BAA+B,CAAM,EAC7D,YAAY,GAAE,WAAyC,EACvD,qBAAqB,GAAE,mBAA0C;IA2B7E;;OAEG;IACG,UAAU,CAAC,MAAM,GAAE,WAAgB;IA+BzC;;;OAGG;YACW,aAAa;IAsD3B;;;;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;IA8CnF;;OAEG;IACH,SAAS,IAIkB,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC;IAGvD;;OAEG;IACH,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM;IAY1B;;;;;;;;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"}
@@ -187,7 +187,7 @@ export default class ConfigParser {
187
187
  * run single spec file only, regardless of multiple-spec specification
188
188
  */
189
189
  if (addPathToSpecs && spec.length > 0) {
190
- this._config.specs = this.setFilePathToFilterOptions(spec, this._config.specs);
190
+ this._config.specs = this.setFilePathToFilterOptions(spec, this._config.specs, object.group);
191
191
  }
192
192
  /**
193
193
  * At this step function allKeywordsContainPath() allows us to make sure
@@ -284,7 +284,7 @@ export default class ConfigParser {
284
284
  specs = isSpecParamPassed ? [...specs, ...suiteSpecs] : suiteSpecs;
285
285
  }
286
286
  // Remove any duplicate tests from the final specs array
287
- specs = [...new Set(specs)];
287
+ specs = filterDublicationArrayItems(specs);
288
288
  // If the --multi-run flag is set, duplicate the specs array N times
289
289
  // Ensure that when --multi-run is used that either --spec or --suite is also used
290
290
  const hasSubsetOfSpecsDefined = isSpecParamPassed || suites.length > 0;
@@ -305,14 +305,14 @@ export default class ConfigParser {
305
305
  * cli argument
306
306
  * @return {String[]} List of files that should be included or excluded
307
307
  */
308
- setFilePathToFilterOptions(cliArgFileList, specs) {
308
+ setFilePathToFilterOptions(cliArgFileList, specs, group) {
309
309
  const filesToFilter = new Set();
310
310
  const fileList = ConfigParser.getFilePaths(specs, this._config.rootDir, this._pathService);
311
311
  cliArgFileList.forEach(filteredFile => {
312
312
  filteredFile = removeLineNumbers(filteredFile);
313
- // Send single file/file glob to getFilePaths - not supporting hierarchy in spec/exclude
314
- // Return value will always be string[]
315
- const globMatchedFiles = ConfigParser.getFilePaths(this._pathService.glob(filteredFile, path.dirname(this.#configFilePath)), this._config.rootDir, this._pathService);
313
+ // Send wildcard or single file glob to getFilePaths
314
+ // Return value will always be string[] or string [][]
315
+ const globMatchedFiles = ConfigParser.getFilePaths(group ? [[filteredFile]] : [filteredFile], this._config.rootDir, this._pathService);
316
316
  if (this._pathService.isFile(filteredFile)) {
317
317
  filesToFilter.add(this._pathService.ensureAbsolutePath(filteredFile, path.dirname(this.#configFilePath)));
318
318
  }
@@ -323,13 +323,13 @@ export default class ConfigParser {
323
323
  // fileList can be a string[] or a string[][]
324
324
  fileList.forEach(file => {
325
325
  if (typeof file === 'string') {
326
- if (file.match(filteredFile)) {
326
+ if (isValidRegex(filteredFile) && file.match(filteredFile)) {
327
327
  filesToFilter.add(file);
328
328
  }
329
329
  }
330
330
  else if (Array.isArray(file)) {
331
331
  file.forEach(subFile => {
332
- if (subFile.match(filteredFile)) {
332
+ if (isValidRegex(filteredFile) && subFile.match(filteredFile)) {
333
333
  filesToFilter.add(subFile);
334
334
  }
335
335
  });
@@ -429,7 +429,7 @@ export default class ConfigParser {
429
429
  filterSpecs(specs, excludeList) {
430
430
  // If 'exclude' is array of paths
431
431
  if (allKeywordsContainPath(excludeList)) {
432
- return specs.reduce((returnVal, currSpec) => {
432
+ const filteredSpec = specs.reduce((returnVal, currSpec) => {
433
433
  if (Array.isArray(currSpec)) {
434
434
  returnVal.push(currSpec.filter(specItem => !excludeList.includes(specItem)));
435
435
  }
@@ -438,9 +438,10 @@ export default class ConfigParser {
438
438
  }
439
439
  return returnVal;
440
440
  }, []);
441
+ return filterEmptyArrayItems(filteredSpec);
441
442
  }
442
443
  // If 'exclude' is array of keywords
443
- return specs.reduce((returnVal, currSpec) => {
444
+ const filteredSpec = specs.reduce((returnVal, currSpec) => {
444
445
  if (Array.isArray(currSpec)) {
445
446
  returnVal.push(currSpec.filter(specItem => !excludeList.some(excludeVal => specItem.includes(excludeVal))));
446
447
  }
@@ -450,6 +451,7 @@ export default class ConfigParser {
450
451
  }
451
452
  return returnVal;
452
453
  }, []);
454
+ return filterEmptyArrayItems(filteredSpec);
453
455
  }
454
456
  shard(specs) {
455
457
  if (!this._config.shard || this._config.shard.total === 1) {
@@ -463,5 +465,20 @@ export default class ConfigParser {
463
465
  }
464
466
  }
465
467
  function allKeywordsContainPath(excludedSpecList) {
466
- return excludedSpecList.every(val => val.includes('/') || val.includes('\\'));
468
+ return excludedSpecList.every(val => val.includes('/') || val.includes('\\') || val.includes('*'));
469
+ }
470
+ function filterEmptyArrayItems(specList) {
471
+ return specList.filter(item => (Array.isArray(item) && item.length) || !Array.isArray(item));
472
+ }
473
+ function filterDublicationArrayItems(specList) {
474
+ return [...new Set(specList.map(item => Array.isArray(item) ? [...new Set(item)] : item))];
475
+ }
476
+ function isValidRegex(expression) {
477
+ try {
478
+ new RegExp(expression);
479
+ return true;
480
+ }
481
+ catch {
482
+ return false;
483
+ }
467
484
  }
@@ -40,7 +40,7 @@ export function makeRelativeToCWD(files = []) {
40
40
  }
41
41
  returnFiles.push(file.startsWith('file:///')
42
42
  ? url.fileURLToPath(file)
43
- : file.includes('/')
43
+ : file.includes('/') && !file.includes('*')
44
44
  ? path.resolve(process.cwd(), file)
45
45
  : file);
46
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/config",
3
- "version": "8.41.0",
3
+ "version": "8.45.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": "8.38.0",
40
40
  "@wdio/types": "8.41.0",
41
- "@wdio/utils": "8.41.0",
41
+ "@wdio/utils": "8.45.0",
42
42
  "decamelize": "^6.0.0",
43
43
  "deepmerge-ts": "^5.0.0",
44
44
  "glob": "^10.2.2",
@@ -51,5 +51,5 @@
51
51
  "minimatch": "^9.0.0",
52
52
  "tsconfig-paths": "^4.1.0"
53
53
  },
54
- "gitHead": "a33b7bfba8013d0f65e54123acc206bd11d38d10"
54
+ "gitHead": "7836fbee7a85a16f2b7faa592969f914c504ba8a"
55
55
  }