@wdio/config
Advanced tools
Comparing version 8.29.1 to 8.29.3
@@ -91,6 +91,6 @@ import type { Capabilities, Options, Services } from '@wdio/types'; | ||
* @param {String[] | String[][]} spec files - list of spec files | ||
* @param {string[]} exclude files - list of exclude files | ||
* @param {string[]} excludeList files - list of exclude files | ||
* @return {String[] | String[][]} list of spec files with excludes removed | ||
*/ | ||
filterSpecs(specs: Spec[], exclude: string[]): Spec[]; | ||
filterSpecs(specs: Spec[], excludeList: string[]): Spec[]; | ||
shard(specs: Spec[]): Spec[]; | ||
@@ -97,0 +97,0 @@ } |
@@ -163,5 +163,16 @@ import path from 'node:path'; | ||
} | ||
if (addPathToSpecs && exclude.length > 0) { | ||
/** | ||
* At this step function allKeywordsContainPath() allows us to make sure | ||
* that all arguments, passed to '--exclude' param, are paths to specs. | ||
* So they can be processed in setFilePathToFilterOptions() | ||
* Otherwise, the application crashes with an error. | ||
* Therefore, if --exclude contains not paths, but keywords, e.g. 'dialog', 'test.component' etc., | ||
* then filtering of excluded specs occurs in the filterSpecs() method | ||
*/ | ||
if (exclude.length > 0 && allKeywordsContainPath(exclude)) { | ||
this._config.exclude = this.setFilePathToFilterOptions(exclude, this._config.exclude); | ||
} | ||
else if (exclude.length > 0) { | ||
this._config.exclude = exclude; | ||
} | ||
} | ||
@@ -216,3 +227,5 @@ /** | ||
let specs = ConfigParser.getFilePaths(this._config.specs, this._config.rootDir, this._pathService); | ||
let exclude = ConfigParser.getFilePaths(this._config.exclude, this._config.rootDir, this._pathService); | ||
let exclude = allKeywordsContainPath(this._config.exclude) | ||
? ConfigParser.getFilePaths(this._config.exclude, this._config.rootDir, this._pathService) | ||
: this._config.exclude || []; | ||
const suites = Array.isArray(this._config.suite) ? this._config.suite : []; | ||
@@ -386,12 +399,26 @@ // only use capability excludes if (CLI) --exclude or config exclude are not defined | ||
* @param {String[] | String[][]} spec files - list of spec files | ||
* @param {string[]} exclude files - list of exclude files | ||
* @param {string[]} excludeList files - list of exclude files | ||
* @return {String[] | String[][]} list of spec files with excludes removed | ||
*/ | ||
filterSpecs(specs, exclude) { | ||
return specs.reduce((returnVal, spec) => { | ||
if (Array.isArray(spec)) { | ||
returnVal.push(spec.filter(specItem => !exclude.includes(specItem))); | ||
filterSpecs(specs, excludeList) { | ||
// If 'exclude' is array of paths | ||
if (allKeywordsContainPath(excludeList)) { | ||
return specs.reduce((returnVal, currSpec) => { | ||
if (Array.isArray(currSpec)) { | ||
returnVal.push(currSpec.filter(specItem => !excludeList.includes(specItem))); | ||
} | ||
else if (excludeList.indexOf(currSpec) === -1) { | ||
returnVal.push(currSpec); | ||
} | ||
return returnVal; | ||
}, []); | ||
} | ||
// If 'exclude' is array of keywords | ||
return specs.reduce((returnVal, currSpec) => { | ||
if (Array.isArray(currSpec)) { | ||
returnVal.push(currSpec.filter(specItem => !excludeList.some(excludeVal => specItem.includes(excludeVal)))); | ||
} | ||
else if (exclude.indexOf(spec) === -1) { | ||
returnVal.push(spec); | ||
const isSpecExcluded = excludeList.some(excludedVal => currSpec.includes(excludedVal)); | ||
if (!isSpecExcluded) { | ||
returnVal.push(currSpec); | ||
} | ||
@@ -412,1 +439,4 @@ return returnVal; | ||
} | ||
function allKeywordsContainPath(excludedSpecList) { | ||
return excludedSpecList.every(val => val.includes('/') || val.includes('\\')); | ||
} |
{ | ||
"name": "@wdio/config", | ||
"version": "8.29.1", | ||
"version": "8.29.3", | ||
"description": "A helper utility to parse and validate WebdriverIO options", | ||
@@ -41,3 +41,3 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"@wdio/types": "8.29.1", | ||
"@wdio/utils": "8.29.1", | ||
"@wdio/utils": "8.29.3", | ||
"decamelize": "^6.0.0", | ||
@@ -55,3 +55,3 @@ "deepmerge-ts": "^5.0.0", | ||
}, | ||
"gitHead": "d434fcf0aaaa9d835789c4c335d319f94a899687" | ||
"gitHead": "4c6433be548950dc6ccf0efff77507dfa2f0b321" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46713
959
+ Added@wdio/utils@8.29.3(transitive)
- Removed@wdio/utils@8.29.1(transitive)
Updated@wdio/utils@8.29.3