@wdio/config 7.25.4 → 7.26.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.
@@ -34,9 +34,10 @@ export default class ConfigParser {
34
34
  */
35
35
  addService(service: Services.Hooks): void;
36
36
  /**
37
- * get excluded files from config pattern
37
+ * determine what specs to run based on the spec(s), suite(s), exclude
38
+ * attributes from CLI, config and capabilities
38
39
  */
39
- getSpecs(capSpecs?: string[], capExclude?: string[]): Spec[];
40
+ getSpecs(capSpecs?: Spec[], capExclude?: Spec[]): Spec[];
40
41
  /**
41
42
  * sets config attribute with file paths from filtering
42
43
  * options from cli argument
@@ -58,10 +59,10 @@ export default class ConfigParser {
58
59
  /**
59
60
  * returns a flattened list of globbed files
60
61
  *
61
- * @param {String[] | String[][]} filenames list of files to glob
62
- * @param {Boolean} flag to indicate omission of warnings
63
- * @param {FileSystemPathService} file system path service for expanding globbed file names
64
- * @param {number} hierarchy depth to prevent recursive calling beyond a depth of 1
62
+ * @param {String[] | String[][]} patterns list of files to glob
63
+ * @param {Boolean} omitWarnings to indicate omission of warnings
64
+ * @param {FileSystemPathService} findAndGlob system path service for expanding globbed file names
65
+ * @param {number} hierarchyDepth depth to prevent recursive calling beyond a depth of 1
65
66
  * @return {String[] | String[][]} list of files
66
67
  */
67
68
  static getFilePaths(patterns: Spec[], omitWarnings?: boolean, findAndGlob?: PathService, hierarchyDepth?: number): Spec[];
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigParser.d.ts","sourceRoot":"","sources":["../../src/lib/ConfigParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAWlE,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAKjE,aAAK,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AAE7B,UAAU,+BAAgC,SAAQ,IAAI,CAA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AAQ,CAAC,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE;IA8C/C;;;;;;;;OAQG;IACH,0BAA0B,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAqCnE;;OAEG;IACH,SAAS;IAIT;;OAEG;IACH,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM;IAQ1B;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,GAAE,WAAyC,EAAE,cAAc,CAAC,EAAE,MAAM;IA+C7I;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;CAU/C"}
@@ -149,17 +149,26 @@ class ConfigParser {
149
149
  }
150
150
  }
151
151
  /**
152
- * get excluded files from config pattern
152
+ * determine what specs to run based on the spec(s), suite(s), exclude
153
+ * attributes from CLI, config and capabilities
153
154
  */
154
155
  getSpecs(capSpecs, capExclude) {
155
156
  var _a;
157
+ const isSpecParamPassed = Array.isArray(this._config.spec);
158
+ // when CLI --spec is explicitly specified, this._config.specs contains the filtered
159
+ // specs matching the passed pattern else the specs defined inside the config are returned
156
160
  let specs = ConfigParser.getFilePaths(this._config.specs, undefined, this._pathService);
157
- let spec = Array.isArray(this._config.spec) ? this._config.spec : [];
158
161
  let exclude = ConfigParser.getFilePaths(this._config.exclude, undefined, this._pathService);
159
162
  let suites = Array.isArray(this._config.suite) ? this._config.suite : [];
160
- /**
161
- * check if user has specified a specific suites to run
162
- */
163
+ // only use capability excludes if (CLI) --exclude or config exclude are not defined
164
+ if (Array.isArray(capExclude) && exclude.length === 0) {
165
+ exclude = ConfigParser.getFilePaths(capExclude, undefined, this._pathService);
166
+ }
167
+ // only use capability specs if (CLI) --spec is not defined
168
+ if (!isSpecParamPassed && Array.isArray(capSpecs)) {
169
+ specs = ConfigParser.getFilePaths(capSpecs, undefined, this._pathService);
170
+ }
171
+ // handle case where user passes --suite via CLI
163
172
  if (suites.length > 0) {
164
173
  let suiteSpecs = [];
165
174
  for (let suiteName of suites) {
@@ -176,29 +185,10 @@ class ConfigParser {
176
185
  'in your config file or doesn\'t contain any files!');
177
186
  }
178
187
  // Allow --suite and --spec to both be defined on the command line
179
- // Removing any duplicate tests that could be included
180
- let tmpSpecs = spec.length > 0 ? [...specs, ...suiteSpecs] : suiteSpecs;
181
- //Only merge capability specs if --spec is not defined
182
- if (spec.length === 0) {
183
- if (Array.isArray(capSpecs)) {
184
- tmpSpecs = ConfigParser.getFilePaths(capSpecs, undefined, this._pathService);
185
- }
186
- if (Array.isArray(capExclude)) {
187
- exclude = ConfigParser.getFilePaths(capExclude, undefined, this._pathService);
188
- }
189
- }
190
- specs = [...new Set(tmpSpecs)];
191
- return this.filterSpecs(specs, exclude);
192
- }
193
- //Only merge capability specs if --spec is not defined
194
- if (spec.length === 0) {
195
- if (Array.isArray(capSpecs)) {
196
- specs = ConfigParser.getFilePaths(capSpecs, undefined, this._pathService);
197
- }
198
- if (Array.isArray(capExclude)) {
199
- exclude = ConfigParser.getFilePaths(capExclude, undefined, this._pathService);
200
- }
188
+ specs = isSpecParamPassed ? [...specs, ...suiteSpecs] : suiteSpecs;
201
189
  }
190
+ // Remove any duplicate tests from the final specs array
191
+ specs = [...new Set(specs)];
202
192
  return this.filterSpecs(specs, exclude);
203
193
  }
204
194
  /**
@@ -216,7 +206,7 @@ class ConfigParser {
216
206
  cliArgFileList.forEach(filteredFile => {
217
207
  filteredFile = (0, utils_1.removeLineNumbers)(filteredFile);
218
208
  // Send single file/file glob to getFilePaths - not supporting hierarchy in spec/exclude
219
- // Return value will alwyas be string[]
209
+ // Return value will always be string[]
220
210
  let globMatchedFiles = ConfigParser.getFilePaths(this._pathService.glob(filteredFile), undefined, this._pathService);
221
211
  if (this._pathService.isFile(filteredFile)) {
222
212
  filesToFilter.add(this._pathService.ensureAbsolutePath(filteredFile));
@@ -268,10 +258,10 @@ class ConfigParser {
268
258
  /**
269
259
  * returns a flattened list of globbed files
270
260
  *
271
- * @param {String[] | String[][]} filenames list of files to glob
272
- * @param {Boolean} flag to indicate omission of warnings
273
- * @param {FileSystemPathService} file system path service for expanding globbed file names
274
- * @param {number} hierarchy depth to prevent recursive calling beyond a depth of 1
261
+ * @param {String[] | String[][]} patterns list of files to glob
262
+ * @param {Boolean} omitWarnings to indicate omission of warnings
263
+ * @param {FileSystemPathService} findAndGlob system path service for expanding globbed file names
264
+ * @param {number} hierarchyDepth depth to prevent recursive calling beyond a depth of 1
275
265
  * @return {String[] | String[][]} list of files
276
266
  */
277
267
  static getFilePaths(patterns, omitWarnings, findAndGlob = new FileSystemPathService_1.default(), hierarchyDepth) {
@@ -281,7 +271,6 @@ class ConfigParser {
281
271
  patterns = [patterns];
282
272
  }
283
273
  // patterns must be an array of strings and/or string arrays
284
- // check and throw and error if not
285
274
  if (!Array.isArray(patterns)) {
286
275
  throw new Error('specs or exclude property should be an array of strings, specs may also be an array of string arrays');
287
276
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/config",
3
- "version": "7.25.4",
3
+ "version": "7.26.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",
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "types": "./build/index.d.ts",
25
25
  "dependencies": {
26
- "@wdio/logger": "7.19.0",
27
- "@wdio/types": "7.25.4",
28
- "@wdio/utils": "7.25.4",
26
+ "@wdio/logger": "7.26.0",
27
+ "@wdio/types": "7.26.0",
28
+ "@wdio/utils": "7.26.0",
29
29
  "deepmerge": "^4.0.0",
30
30
  "glob": "^8.0.3"
31
31
  },
@@ -36,5 +36,5 @@
36
36
  "minimatch": "^5.0.0",
37
37
  "tsconfig-paths": "^4.0.0"
38
38
  },
39
- "gitHead": "7e41cd86779937722b6f824d10375b039aee620f"
39
+ "gitHead": "573927a79dc0a2b9d9a9e19e7d1b8c1ff9fac308"
40
40
  }