@wdio/config 9.0.0-alpha.9 → 9.0.4

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,5 +1,5 @@
1
1
  import type { Options, Services } from '@wdio/types';
2
- export declare const DEFAULT_CONFIGS: () => Omit<Options.Testrunner, 'capabilities'>;
2
+ export declare const DEFAULT_CONFIGS: () => Options.Testrunner;
3
3
  export declare const SUPPORTED_HOOKS: (keyof Services.Hooks)[];
4
4
  export declare const SUPPORTED_FILE_EXTENSIONS: string[];
5
5
  export declare const NO_NAMED_CONFIG_EXPORT: string;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKpD,eAAO,MAAM,eAAe,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAuFzE,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,EAOnD,CAAA;AAED,eAAO,MAAM,yBAAyB,UAErC,CAAA;AAED,eAAO,MAAM,sBAAsB,QAIlC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKpD,eAAO,MAAM,eAAe,EAAE,MAAM,OAAO,CAAC,UAgF1C,CAAA;AAEF,eAAO,MAAM,eAAe,EAAE,CAAC,MAAM,QAAQ,CAAC,KAAK,CAAC,EAOnD,CAAA;AAED,eAAO,MAAM,yBAAyB,UAErC,CAAA;AAED,eAAO,MAAM,sBAAsB,QAIlC,CAAA"}
package/build/index.js CHANGED
@@ -1,13 +1,125 @@
1
- /* istanbul ignore file */
2
- import { DEFAULT_CONFIGS } from './constants.js';
3
- import { validateConfig, isCloudCapability } from './utils.js';
4
- export {
5
- /**
6
- * configuration helpers
7
- */
8
- validateConfig, isCloudCapability,
9
- /**
10
- * constants
11
- */
12
- DEFAULT_CONFIGS };
13
- export * from './types.js';
1
+ // src/constants.ts
2
+ var DEFAULT_TIMEOUT = 1e4;
3
+ var DEFAULT_CONFIGS = () => ({
4
+ specs: [],
5
+ suites: {},
6
+ exclude: [],
7
+ outputDir: void 0,
8
+ logLevel: "info",
9
+ logLevels: {},
10
+ groupLogsByTestSpec: false,
11
+ excludeDriverLogs: [],
12
+ bail: 0,
13
+ waitforInterval: 500,
14
+ waitforTimeout: 5e3,
15
+ framework: "mocha",
16
+ reporters: [],
17
+ services: [],
18
+ maxInstances: 100,
19
+ maxInstancesPerCapability: 100,
20
+ injectGlobals: true,
21
+ filesToWatch: [],
22
+ connectionRetryTimeout: 12e4,
23
+ connectionRetryCount: 3,
24
+ execArgv: [],
25
+ runnerEnv: {},
26
+ runner: "local",
27
+ shard: {
28
+ current: 1,
29
+ total: 1
30
+ },
31
+ specFileRetries: 0,
32
+ specFileRetriesDelay: 0,
33
+ specFileRetriesDeferred: false,
34
+ reporterSyncInterval: 100,
35
+ reporterSyncTimeout: 5e3,
36
+ cucumberFeaturesWithLineNumbers: [],
37
+ /**
38
+ * framework defaults
39
+ */
40
+ mochaOpts: {
41
+ timeout: DEFAULT_TIMEOUT
42
+ },
43
+ jasmineOpts: {
44
+ defaultTimeoutInterval: DEFAULT_TIMEOUT
45
+ },
46
+ cucumberOpts: {
47
+ timeout: DEFAULT_TIMEOUT
48
+ },
49
+ /**
50
+ * hooks
51
+ */
52
+ onPrepare: [],
53
+ onWorkerStart: [],
54
+ onWorkerEnd: [],
55
+ before: [],
56
+ beforeSession: [],
57
+ beforeSuite: [],
58
+ beforeHook: [],
59
+ beforeTest: [],
60
+ beforeCommand: [],
61
+ afterCommand: [],
62
+ afterTest: [],
63
+ afterHook: [],
64
+ afterSuite: [],
65
+ afterSession: [],
66
+ after: [],
67
+ onComplete: [],
68
+ onReload: [],
69
+ beforeAssertion: [],
70
+ afterAssertion: [],
71
+ /**
72
+ * cucumber specific hooks
73
+ */
74
+ beforeFeature: [],
75
+ beforeScenario: [],
76
+ beforeStep: [],
77
+ afterStep: [],
78
+ afterScenario: [],
79
+ afterFeature: []
80
+ });
81
+
82
+ // src/utils.ts
83
+ import decamelize from "decamelize";
84
+ function isCloudCapability(caps) {
85
+ return Boolean(caps && (caps["bstack:options"] || caps["sauce:options"] || caps["tb:options"]));
86
+ }
87
+ function validateConfig(defaults, options, keysToKeep = []) {
88
+ const params = {};
89
+ for (const [name, expectedOption] of Object.entries(defaults)) {
90
+ if (typeof options[name] === "undefined" && !expectedOption.default && expectedOption.required) {
91
+ throw new Error(`Required option "${name.toString()}" is missing`);
92
+ }
93
+ if (typeof options[name] === "undefined" && expectedOption.default) {
94
+ params[name] = expectedOption.default;
95
+ }
96
+ if (typeof options[name] !== "undefined") {
97
+ const optValue = options[name];
98
+ if (typeof optValue !== expectedOption.type) {
99
+ throw new Error(`Expected option "${name.toString()}" to be type of ${expectedOption.type} but was ${typeof options[name]}`);
100
+ }
101
+ if (typeof expectedOption.validate === "function") {
102
+ try {
103
+ expectedOption.validate(optValue);
104
+ } catch (e) {
105
+ throw new Error(`Type check for option "${name.toString()}" failed: ${e.message}`);
106
+ }
107
+ }
108
+ if (typeof optValue === "string" && expectedOption.match && !optValue.match(expectedOption.match)) {
109
+ throw new Error(`Option "${name.toString()}" doesn't match expected values: ${expectedOption.match}`);
110
+ }
111
+ params[name] = options[name];
112
+ }
113
+ }
114
+ for (const [name, option] of Object.entries(options)) {
115
+ if (keysToKeep.includes(name)) {
116
+ params[name] = option;
117
+ }
118
+ }
119
+ return params;
120
+ }
121
+ export {
122
+ DEFAULT_CONFIGS,
123
+ isCloudCapability,
124
+ validateConfig
125
+ };
@@ -1,14 +1,15 @@
1
1
  import type { Capabilities, Options, Services } from '@wdio/types';
2
- import type { PathService, ModuleImportService } from '../types.js';
2
+ import type { PathService } from '../types.js';
3
3
  type Spec = string | string[];
4
- interface TestrunnerOptionsWithParameters extends Omit<Options.Testrunner, 'capabilities'> {
4
+ interface TestrunnerOptionsWithParameters extends Options.Testrunner {
5
5
  watch?: boolean;
6
6
  coverage?: boolean;
7
7
  spec?: string[];
8
8
  suite?: string[];
9
9
  repeat?: number;
10
- capabilities?: Capabilities.RemoteCapabilities;
10
+ capabilities?: Capabilities.TestrunnerCapabilities;
11
11
  rootDir: string;
12
+ tsConfigPath?: string;
12
13
  }
13
14
  interface MergeConfig extends Omit<Partial<TestrunnerOptionsWithParameters>, 'specs' | 'exclude'> {
14
15
  specs?: Spec[];
@@ -24,15 +25,14 @@ export default class ConfigParser {
24
25
  */
25
26
  private _initialConfig;
26
27
  private _pathService;
27
- private _moduleRequireService;
28
28
  private _config;
29
- private _capabilities;
29
+ private _capabilities?;
30
30
  constructor(configFilePath: string,
31
31
  /**
32
32
  * config options parsed in via CLI arguments and applied before
33
33
  * trying to compile config file
34
34
  */
35
- _initialConfig?: Partial<TestrunnerOptionsWithParameters>, _pathService?: PathService, _moduleRequireService?: ModuleImportService);
35
+ _initialConfig?: Partial<TestrunnerOptionsWithParameters>, _pathService?: PathService);
36
36
  /**
37
37
  * initializes the config object
38
38
  */
@@ -75,7 +75,7 @@ export default class ConfigParser {
75
75
  /**
76
76
  * return capabilities
77
77
  */
78
- getCapabilities(i?: number): Capabilities.DesiredCapabilities | Capabilities.W3CCapabilities | Capabilities.RemoteCapabilities;
78
+ getCapabilities(i?: number): Capabilities.TestrunnerCapabilities | Capabilities.RequestedStandaloneCapabilities;
79
79
  /**
80
80
  * returns a flattened list of globbed files
81
81
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigParser.d.ts","sourceRoot":"","sources":["../../src/node/ConfigParser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAQlE,OAAO,KAAK,EAAE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