@wdio/cli 8.0.0-alpha.565 → 8.0.0-alpha.577

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.
@@ -75,7 +75,7 @@ const runConfig = async function (useYarn, yes, exit = false) {
75
75
  * add ts-node if TypeScript is desired but not installed
76
76
  */
77
77
  if (parsedAnswers.isUsingTypeScript) {
78
- if (!hasPackage('ts-node')) {
78
+ if (!await hasPackage('ts-node')) {
79
79
  packagesToInstall.push('ts-node', 'typescript');
80
80
  }
81
81
  const types = [
@@ -112,17 +112,17 @@ const runConfig = async function (useYarn, yes, exit = false) {
112
112
  * add @babel/register package if not installed
113
113
  */
114
114
  if (parsedAnswers.isUsingBabel) {
115
- if (!hasPackage('@babel/register')) {
115
+ if (!await hasPackage('@babel/register')) {
116
116
  packagesToInstall.push('@babel/register');
117
117
  }
118
118
  /**
119
119
  * setup Babel if no config file exists
120
120
  */
121
121
  if (!hasFile('babel.config.js')) {
122
- if (!hasPackage('@babel/core')) {
122
+ if (!await hasPackage('@babel/core')) {
123
123
  packagesToInstall.push('@babel/core');
124
124
  }
125
- if (!hasPackage('@babel/preset-env')) {
125
+ if (!await hasPackage('@babel/preset-env')) {
126
126
  packagesToInstall.push('@babel/preset-env');
127
127
  }
128
128
  await fs.writeFile(path.join(process.cwd(), 'babel.config.js'), `module.exports = ${JSON.stringify({
@@ -169,6 +169,6 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "fr
169
169
  };
170
170
  }>>;
171
171
  export declare function launchWithStdin(wdioConfPath: string, params: Partial<RunCommandArguments>): void;
172
- export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void> | cp.ChildProcess;
172
+ export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void | cp.ChildProcess>;
173
173
  export declare function handler(argv: RunCommandArguments): Promise<void | cp.ChildProcess>;
174
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,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,mCAgDjF;AAED,wBAAsB,OAAO,CAAE,IAAI,EAAE,mBAAmB,mCA0CvD"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASlC,CAAA;AAED,wBAAgB,eAAe,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAc1F;AAED,wBAAsB,MAAM,CAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,mCAmDvF;AAED,wBAAsB,OAAO,CAAE,IAAI,EAAE,mBAAmB,mCA0CvD"}
@@ -96,7 +96,6 @@ export const builder = (yargs) => {
96
96
  .example('$0 run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
97
97
  .example('$0 run wdio.conf.js --mochaOpts.timeout 60000', 'Run suite with custom Mocha timeout')
98
98
  .example('$0 run wdio.conf.js --autoCompileOpts.autoCompile=false', 'Disable auto-loading of ts-node or @babel/register')
99
- .example('$0 run wdio.conf.js --autoCompileOpts.tsNodeOpts.project=configs/bdd-tsconfig.json', 'Run suite with ts-node using custom tsconfig.json')
100
99
  .epilogue(CLI_EPILOGUE)
101
100
  .help();
102
101
  };
@@ -114,7 +113,7 @@ export function launchWithStdin(wdioConfPath, params) {
114
113
  launch(wdioConfPath, params);
115
114
  });
116
115
  }
117
- export function launch(wdioConfPath, params) {
116
+ export async function launch(wdioConfPath, params) {
118
117
  /**
119
118
  * In order to load TypeScript files in ESM we need to apply the ts-node loader.
120
119
  * Let's have WebdriverIO set it automatically if the user doesn't.
@@ -126,12 +125,15 @@ export function launch(wdioConfPath, params) {
126
125
  NODE_OPTIONS?.includes('ts-node/esm'));
127
126
  if (wdioConfPath.endsWith('.ts') && !runsWithLoader && nodePath) {
128
127
  NODE_OPTIONS += ' --loader ts-node/esm/transpile-only --no-warnings';
128
+ const localTSConfigPath = path.join(path.dirname(wdioConfPath), 'tsconfig.json');
129
+ const hasLocalTSConfig = await fs.access(localTSConfigPath).then(() => true, () => false);
129
130
  const tsProcess = cp.spawn(nodePath, process.argv.slice(1), {
130
131
  cwd: process.cwd(),
131
132
  detached: true,
132
133
  stdio: 'inherit',
133
134
  env: {
134
135
  ...process.env,
136
+ ...(hasLocalTSConfig ? { TS_NODE_PROJECT: localTSConfigPath } : {}),
135
137
  NODE_OPTIONS
136
138
  }
137
139
  });
@@ -10,36 +10,6 @@ export const config: Options.Testrunner = {<%
10
10
  // ====================
11
11
  // Runner Configuration
12
12
  // ====================
13
- //<%
14
- if(answers.isUsingTypeScript){ %>
15
- //
16
- // =====================
17
- // ts-node Configurations
18
- // =====================
19
- //
20
- // You can write tests using TypeScript to get autocompletion and type safety.
21
- // You will need typescript and ts-node installed as devDependencies.
22
- // WebdriverIO will automatically detect if these dependencies are installed
23
- // and will compile your config and tests for you.
24
- // If you need to configure how ts-node runs please use the
25
- // environment variables for ts-node or use wdio config's autoCompileOpts section.
26
- //
27
-
28
- autoCompileOpts: {
29
- autoCompile: true,
30
- // see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
31
- // for all available options
32
- tsNodeOpts: {
33
- transpileOnly: true,
34
- project: 'test/tsconfig.json'
35
- }
36
- // tsconfig-paths is only used if "tsConfigPathsOpts" are provided, if you
37
- // do please make sure "tsconfig-paths" is installed as dependency
38
- // tsConfigPathsOpts: {
39
- // baseUrl: './'
40
- // }
41
- },<% }
42
-
43
13
  if(answers.expEnvAccessKey){ %>
44
14
  hostname: '<%- answers.expEnvHostname %>',
45
15
  <% if (answers.expEnvPort === '443'){%>protocol: 'https',
package/build/utils.d.ts CHANGED
@@ -77,7 +77,7 @@ export declare function hasFile(filename: string): boolean;
77
77
  * Check if package is installed
78
78
  * @param {string} package to check existance for
79
79
  */
80
- export declare function hasPackage(pkg: string): boolean;
80
+ export declare function hasPackage(pkg: string): Promise<boolean>;
81
81
  /**
82
82
  * generate test files based on CLI answers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,GAAG,MAgBpE,CAAA;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+C9D;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAE,QAAQ,EAAE,MAAM,WAOxC;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAE,GAAG,EAAE,MAAM,oBAO5C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAE,OAAO,EAAE,aAAa,iBA6B9D;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CA+BpE;AAED,wBAAgB,wBAAwB,CAAE,OAAO,EAAE,YAAY;;;;;EA+B9D;AAED,wBAAgB,eAAe,CAAE,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,UAIhF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,YAgBnF"}
package/build/utils.js CHANGED
@@ -2,7 +2,6 @@ import fs from 'node:fs/promises';
2
2
  import fsSync from 'node:fs';
3
3
  import { dirname } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
- import { createRequire } from 'node:module';
6
5
  import { execSync } from 'node:child_process';
7
6
  import { promisify } from 'node:util';
8
7
  import ejs from 'ejs';
@@ -11,11 +10,11 @@ import inquirer from 'inquirer';
11
10
  import pickBy from 'lodash.pickby';
12
11
  import logger from '@wdio/logger';
13
12
  import readDir from 'recursive-readdir';
13
+ import { resolve } from 'import-meta-resolve';
14
14
  import { SevereServiceError } from 'webdriverio';
15
15
  import { ConfigParser } from '@wdio/config';
16
16
  import { CAPABILITY_KEYS } from '@wdio/protocols';
17
17
  import { EXCLUSIVE_SERVICES, ANDROID_CONFIG, IOS_CONFIG, QUESTIONNAIRE, COMMUNITY_PACKAGES_WITH_V8_SUPPORT } from './constants.js';
18
- const require = createRequire(import.meta.url);
19
18
  const log = logger('@wdio/cli:utils');
20
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
21
20
  const VERSION_REGEXP = /(\d+)\.(\d+)\.(\d+)-(alpha|beta|)\.(\d+)\+(.+)/g;
@@ -279,16 +278,9 @@ export function hasFile(filename) {
279
278
  * Check if package is installed
280
279
  * @param {string} package to check existance for
281
280
  */
282
- export function hasPackage(pkg) {
281
+ export async function hasPackage(pkg) {
283
282
  try {
284
- /**
285
- * this is only for testing purposes as we want to check whether
286
- * we add `@babel/register` to the packages to install when resolving fails
287
- */
288
- if (process.env.VITEST_WORKER_ID && process.env.WDIO_TEST_THROW_RESOLVE) {
289
- throw new Error('resolve error');
290
- }
291
- require.resolve(pkg);
283
+ await resolve(pkg, import.meta.url);
292
284
  return true;
293
285
  }
294
286
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/cli",
3
- "version": "8.0.0-alpha.565+9959d0e91",
3
+ "version": "8.0.0-alpha.577+73cd77ef7",
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",
@@ -40,24 +40,25 @@
40
40
  "@types/lodash.union": "^4.6.7",
41
41
  "@types/recursive-readdir": "^2.2.1",
42
42
  "@types/yargs": "^17.0.10",
43
- "@wdio/config": "8.0.0-alpha.565+9959d0e91",
44
- "@wdio/globals": "8.0.0-alpha.565+9959d0e91",
45
- "@wdio/logger": "8.0.0-alpha.565+9959d0e91",
46
- "@wdio/protocols": "8.0.0-alpha.565+9959d0e91",
47
- "@wdio/types": "8.0.0-alpha.565+9959d0e91",
48
- "@wdio/utils": "8.0.0-alpha.565+9959d0e91",
43
+ "@wdio/config": "8.0.0-alpha.577+73cd77ef7",
44
+ "@wdio/globals": "8.0.0-alpha.577+73cd77ef7",
45
+ "@wdio/logger": "8.0.0-alpha.577+73cd77ef7",
46
+ "@wdio/protocols": "8.0.0-alpha.577+73cd77ef7",
47
+ "@wdio/types": "8.0.0-alpha.577+73cd77ef7",
48
+ "@wdio/utils": "8.0.0-alpha.577+73cd77ef7",
49
49
  "async-exit-hook": "^2.0.1",
50
50
  "chalk": "^5.0.1",
51
51
  "chokidar": "^3.5.3",
52
52
  "cli-spinners": "^2.6.1",
53
53
  "ejs": "^3.1.8",
54
+ "import-meta-resolve": "^2.1.0",
54
55
  "inquirer": "9.1.2",
55
56
  "lodash.flattendeep": "^4.4.0",
56
57
  "lodash.pickby": "^4.6.0",
57
58
  "lodash.union": "^4.6.0",
58
59
  "mkdirp": "^1.0.4",
59
60
  "recursive-readdir": "^2.2.2",
60
- "webdriverio": "8.0.0-alpha.565+9959d0e91",
61
+ "webdriverio": "8.0.0-alpha.577+73cd77ef7",
61
62
  "yargs": "^17.5.1",
62
63
  "yarn-install": "^1.0.0"
63
64
  },
@@ -67,5 +68,5 @@
67
68
  "devDependencies": {
68
69
  "@types/node": "^18.0.0"
69
70
  },
70
- "gitHead": "9959d0e91c0f7d2991a5a0c1eb34d288894dae74"
71
+ "gitHead": "73cd77ef7887819c56dc98932a0c34e8af10b64a"
71
72
  }