@wdio/cli 8.0.0-alpha.331 → 8.0.0-alpha.365

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,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ import cp from 'node:child_process';
1
3
  import type { Argv } from 'yargs';
2
4
  import type { RunCommandArguments } from '../types';
3
5
  export declare const command = "run <configPath>";
@@ -167,6 +169,6 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "fr
167
169
  };
168
170
  }>>;
169
171
  export declare function launchWithStdin(wdioConfPath: string, params: Partial<RunCommandArguments>): void;
170
- export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void>;
171
- export declare function handler(argv: RunCommandArguments): Promise<void>;
172
+ export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void> | cp.ChildProcess;
173
+ export declare function handler(argv: RunCommandArguments): Promise<void | cp.ChildProcess>;
172
174
  //# sourceMappingURL=run.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAE1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUlC,CAAA;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAc1F;AAED,wBAAgB,MAAM,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,iBAgBjF;AAED,wBAAsB,OAAO,CAAE,IAAI,EAAE,mBAAmB,iBAmCvD"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAE1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUlC,CAAA;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAc1F;AAED,wBAAgB,MAAM,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,mCA0CjF;AAED,wBAAsB,OAAO,CAAE,IAAI,EAAE,mBAAmB,mCA0CvD"}
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
- import fs from 'fs-extra';
2
+ import fs from 'node:fs/promises';
3
+ import cp from 'node:child_process';
3
4
  import Launcher from '../launcher.js';
4
5
  import Watcher from '../watcher.js';
5
6
  import { missingConfigurationPrompt } from './config.js';
@@ -114,6 +115,27 @@ export function launchWithStdin(wdioConfPath, params) {
114
115
  });
115
116
  }
116
117
  export function launch(wdioConfPath, params) {
118
+ /**
119
+ * In order to load TypeScript files in ESM we need to apply the ts-node loader.
120
+ * Let's have WebdriverIO set it automatically if the user doesn't.
121
+ */
122
+ const nodePath = process.argv[0];
123
+ let NODE_OPTIONS = process.env.NODE_OPTIONS || '';
124
+ const runsWithLoader = (Boolean(process.argv.find((arg) => arg.startsWith('--loader')) &&
125
+ process.argv.find((arg) => arg.endsWith('ts-node/esm'))) ||
126
+ NODE_OPTIONS?.includes('ts-node/esm'));
127
+ if (wdioConfPath.endsWith('.ts') && !runsWithLoader && nodePath) {
128
+ NODE_OPTIONS += ' --loader ts-node/esm/transpile-only --no-warnings';
129
+ return cp.spawn(nodePath, process.argv.slice(1), {
130
+ cwd: process.cwd(),
131
+ detached: true,
132
+ stdio: 'inherit',
133
+ env: {
134
+ ...process.env,
135
+ NODE_OPTIONS
136
+ }
137
+ });
138
+ }
117
139
  const launcher = new Launcher(wdioConfPath, params);
118
140
  return launcher.run()
119
141
  .then((...args) => {
@@ -132,12 +154,15 @@ export function launch(wdioConfPath, params) {
132
154
  }
133
155
  export async function handler(argv) {
134
156
  const { configPath, ...params } = argv;
135
- if (!fs.existsSync(configPath)) {
157
+ const canAccessConfigPath = await fs.access(configPath).then(() => true, () => false);
158
+ if (!canAccessConfigPath) {
136
159
  const configFullPath = path.join(process.cwd(), configPath);
137
160
  await missingConfigurationPrompt('run', configFullPath);
138
161
  }
139
162
  const localConf = path.join(process.cwd(), 'wdio.conf.js');
140
- const wdioConf = configPath || (fs.existsSync(localConf) ? localConf : undefined);
163
+ const wdioConf = configPath || ((await fs.access(localConf).then(() => true, () => false))
164
+ ? localConf
165
+ : undefined);
141
166
  /**
142
167
  * if `--watch` param is set, run launcher in watch mode
143
168
  */
package/build/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ /// <reference types="node" />
1
2
  import Launcher from './launcher.js';
2
- export declare const run: () => Promise<void>;
3
+ export declare const run: () => Promise<void | import("child_process").ChildProcess>;
3
4
  export default Launcher;
4
5
  export * from './types.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,QAAQ,MAAM,eAAe,CAAA;AAqBpC,eAAO,MAAM,GAAG,qBA0Df,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAOA,OAAO,QAAQ,MAAM,eAAe,CAAA;AAqBpC,eAAO,MAAM,GAAG,4DA0Df,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,cAAc,YAAY,CAAA"}
@@ -4,25 +4,31 @@ import logger from '@wdio/logger';
4
4
  import { getRunnerName } from './utils.js';
5
5
  const log = logger('@wdio/cli');
6
6
  export default class WDIOCLInterface extends EventEmitter {
7
+ _config;
8
+ totalWorkerCnt;
9
+ _isWatchMode;
10
+ hasAnsiSupport;
11
+ result = {
12
+ finished: 0,
13
+ passed: 0,
14
+ retries: 0,
15
+ failed: 0
16
+ };
17
+ _jobs = new Map();
18
+ _specFileRetries;
19
+ _specFileRetriesDelay;
20
+ _skippedSpecs = 0;
21
+ _inDebugMode = false;
22
+ _start = new Date();
23
+ _messages = {
24
+ reporter: {},
25
+ debugger: {}
26
+ };
7
27
  constructor(_config, totalWorkerCnt, _isWatchMode = false) {
8
28
  super();
9
29
  this._config = _config;
10
30
  this.totalWorkerCnt = totalWorkerCnt;
11
31
  this._isWatchMode = _isWatchMode;
12
- this.result = {
13
- finished: 0,
14
- passed: 0,
15
- retries: 0,
16
- failed: 0
17
- };
18
- this._jobs = new Map();
19
- this._skippedSpecs = 0;
20
- this._inDebugMode = false;
21
- this._start = new Date();
22
- this._messages = {
23
- reporter: {},
24
- debugger: {}
25
- };
26
32
  /**
27
33
  * Colors can be forcibly enabled/disabled with env variable `FORCE_COLOR`
28
34
  * `FORCE_COLOR=1` - forcibly enable colors
package/build/launcher.js CHANGED
@@ -8,18 +8,25 @@ import CLInterface from './interface.js';
8
8
  import { runLauncherHook, runOnCompleteHook, runServiceHook } from './utils.js';
9
9
  const log = logger('@wdio/cli:launcher');
10
10
  class Launcher {
11
+ _configFilePath;
12
+ _args;
13
+ _isWatchMode;
14
+ configParser = new ConfigParser();
15
+ isMultiremote = false;
16
+ runner;
17
+ interface;
18
+ _exitCode = 0;
19
+ _hasTriggeredExitRoutine = false;
20
+ _schedule = [];
21
+ _rid = [];
22
+ _runnerStarted = 0;
23
+ _runnerFailed = 0;
24
+ _launcher;
25
+ _resolve;
11
26
  constructor(_configFilePath, _args = {}, _isWatchMode = false) {
12
27
  this._configFilePath = _configFilePath;
13
28
  this._args = _args;
14
29
  this._isWatchMode = _isWatchMode;
15
- this.configParser = new ConfigParser();
16
- this.isMultiremote = false;
17
- this._exitCode = 0;
18
- this._hasTriggeredExitRoutine = false;
19
- this._schedule = [];
20
- this._rid = [];
21
- this._runnerStarted = 0;
22
- this._runnerFailed = 0;
23
30
  /**
24
31
  * merge auto compile opts to understand how to parse the config
25
32
  */
package/build/utils.js CHANGED
@@ -21,6 +21,7 @@ const VERSION_REGEXP = /(\d+)\.(\d+)\.(\d+)-(alpha|beta|)\.(\d+)\+(.+)/g;
21
21
  const TEMPLATE_ROOT_DIR = path.join(__dirname, 'templates', 'exampleFiles');
22
22
  const renderFile = promisify(ejs.renderFile);
23
23
  export class HookError extends SevereServiceError {
24
+ origin;
24
25
  constructor(message, origin) {
25
26
  super(message);
26
27
  this.origin = origin;
package/build/watcher.js CHANGED
@@ -6,6 +6,10 @@ import union from 'lodash.union';
6
6
  import Launcher from './launcher.js';
7
7
  const log = logger('@wdio/cli:watch');
8
8
  export default class Watcher {
9
+ _configFile;
10
+ _args;
11
+ _launcher;
12
+ _specs;
9
13
  constructor(_configFile, _args) {
10
14
  this._configFile = _configFile;
11
15
  this._args = _args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/cli",
3
- "version": "8.0.0-alpha.331+78ec9a352",
3
+ "version": "8.0.0-alpha.365+ea5d90e26",
4
4
  "description": "WebdriverIO testrunner command line interface",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cli",
@@ -41,25 +41,25 @@
41
41
  "@types/lodash.union": "^4.6.7",
42
42
  "@types/recursive-readdir": "^2.2.1",
43
43
  "@types/yargs": "^17.0.10",
44
- "@wdio/config": "8.0.0-alpha.331+78ec9a352",
45
- "@wdio/globals": "8.0.0-alpha.331+78ec9a352",
46
- "@wdio/logger": "8.0.0-alpha.331+78ec9a352",
47
- "@wdio/protocols": "8.0.0-alpha.331+78ec9a352",
48
- "@wdio/types": "8.0.0-alpha.331+78ec9a352",
49
- "@wdio/utils": "8.0.0-alpha.331+78ec9a352",
44
+ "@wdio/config": "8.0.0-alpha.365+ea5d90e26",
45
+ "@wdio/globals": "8.0.0-alpha.365+ea5d90e26",
46
+ "@wdio/logger": "8.0.0-alpha.365+ea5d90e26",
47
+ "@wdio/protocols": "8.0.0-alpha.365+ea5d90e26",
48
+ "@wdio/types": "8.0.0-alpha.365+ea5d90e26",
49
+ "@wdio/utils": "8.0.0-alpha.365+ea5d90e26",
50
50
  "async-exit-hook": "^2.0.1",
51
51
  "chalk": "^5.0.1",
52
52
  "chokidar": "^3.5.3",
53
53
  "cli-spinners": "^2.6.1",
54
54
  "ejs": "^3.1.8",
55
55
  "fs-extra": "^10.1.0",
56
- "inquirer": "9.1.1",
56
+ "inquirer": "9.1.2",
57
57
  "lodash.flattendeep": "^4.4.0",
58
58
  "lodash.pickby": "^4.6.0",
59
59
  "lodash.union": "^4.6.0",
60
60
  "mkdirp": "^1.0.4",
61
61
  "recursive-readdir": "^2.2.2",
62
- "webdriverio": "8.0.0-alpha.331+78ec9a352",
62
+ "webdriverio": "8.0.0-alpha.365+ea5d90e26",
63
63
  "yargs": "^17.5.1",
64
64
  "yarn-install": "^1.0.0"
65
65
  },
@@ -69,5 +69,5 @@
69
69
  "devDependencies": {
70
70
  "@types/node": "^18.0.0"
71
71
  },
72
- "gitHead": "78ec9a35262f7d5ff4001cf777553f0a3c173d6d"
72
+ "gitHead": "ea5d90e263106af626e420bab7825bac4beb1dfe"
73
73
  }