@wdio/cli 8.18.2 → 8.20.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.
- package/build/cjs/index.js +2 -1
- package/build/commands/config.d.ts +2 -2
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +6 -6
- package/build/commands/install.d.ts +0 -5
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +20 -16
- package/build/commands/repl.d.ts +6 -0
- package/build/commands/repl.d.ts.map +1 -1
- package/build/commands/run.d.ts +15 -1
- package/build/commands/run.d.ts.map +1 -1
- package/build/commands/run.js +11 -0
- package/build/constants.d.ts +2 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +258 -6
- package/build/install.d.ts +4 -0
- package/build/install.d.ts.map +1 -0
- package/build/install.js +39 -0
- package/build/interface.d.ts +2 -1
- package/build/interface.d.ts.map +1 -1
- package/build/interface.js +10 -2
- package/build/launcher.d.ts +1 -1
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +11 -2
- package/build/types.d.ts +1 -1
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +9 -9
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +31 -30
- package/package.json +10 -10
package/build/cjs/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "ya
|
|
|
41
41
|
};
|
|
42
42
|
}>>;
|
|
43
43
|
export declare const parseAnswers: (yes: boolean) => Promise<ParsedAnswers>;
|
|
44
|
-
export declare function runConfigCommand(parsedAnswers: ParsedAnswers,
|
|
44
|
+
export declare function runConfigCommand(parsedAnswers: ParsedAnswers, npmTag: string): Promise<void>;
|
|
45
45
|
export declare function handler(argv: ConfigCommandArguments, runConfigCmd?: typeof runConfigCommand): Promise<{
|
|
46
46
|
success: boolean;
|
|
47
47
|
parsedAnswers: ParsedAnswers;
|
|
@@ -69,5 +69,5 @@ export declare function canAccessConfigPath(configPath: string): Promise<string
|
|
|
69
69
|
* @param {boolean} useYarn parameter set to true if yarn is used
|
|
70
70
|
* @param {Function} runConfigCmd runConfig method to be replaceable for unit testing
|
|
71
71
|
*/
|
|
72
|
-
export declare function missingConfigurationPrompt(command: string, configPath: string,
|
|
72
|
+
export declare function missingConfigurationPrompt(command: string, configPath: string, runConfigCmd?: typeof runConfigCommand): Promise<false | undefined>;
|
|
73
73
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAWjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIxE,eAAO,MAAM,OAAO,WAAW,CAAA;AAC/B,eAAO,MAAM,IAAI,4EAA4E,CAAA;AAE7F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;GAKlC,CAAA;AAED,eAAO,MAAM,YAAY,QAAwB,OAAO,KAAG,QAAQ,aAAa,CAyF/E,CAAA;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAWjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAIxE,eAAO,MAAM,OAAO,WAAW,CAAA;AAC/B,eAAO,MAAM,IAAI,4EAA4E,CAAA;AAE7F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;GAKlC,CAAA;AAED,eAAO,MAAM,YAAY,QAAwB,OAAO,KAAG,QAAQ,aAAa,CAyF/E,CAAA;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAsBlF;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,sBAAsB,EAAE,YAAY,0BAAmB;;;;GAQ1F;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM;;;GAMzD;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,+BAQ3D;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,0BAAmB,8BA4BpH"}
|
package/build/commands/config.js
CHANGED
|
@@ -42,7 +42,7 @@ export const parseAnswers = async function (yes) {
|
|
|
42
42
|
const reporterPackages = answers.reporters.map((reporter) => convertPackageHashToObject(reporter));
|
|
43
43
|
const presetPackage = convertPackageHashToObject(answers.preset || '');
|
|
44
44
|
const projectProps = await getProjectProps(process.cwd());
|
|
45
|
-
const projectRootDir = getProjectRoot(answers
|
|
45
|
+
const projectRootDir = await getProjectRoot(answers);
|
|
46
46
|
const packagesToInstall = [
|
|
47
47
|
runnerPackage.package,
|
|
48
48
|
frameworkPackage.package,
|
|
@@ -115,12 +115,12 @@ export const parseAnswers = async function (yes) {
|
|
|
115
115
|
wdioConfigPath
|
|
116
116
|
};
|
|
117
117
|
};
|
|
118
|
-
export async function runConfigCommand(parsedAnswers,
|
|
118
|
+
export async function runConfigCommand(parsedAnswers, npmTag) {
|
|
119
119
|
console.log('\n');
|
|
120
120
|
await createPackageJSON(parsedAnswers);
|
|
121
121
|
await setupTypeScript(parsedAnswers);
|
|
122
122
|
await setupBabel(parsedAnswers);
|
|
123
|
-
await npmInstall(parsedAnswers,
|
|
123
|
+
await npmInstall(parsedAnswers, npmTag);
|
|
124
124
|
await createWDIOConfig(parsedAnswers);
|
|
125
125
|
await createWDIOScript(parsedAnswers);
|
|
126
126
|
/**
|
|
@@ -135,7 +135,7 @@ export async function runConfigCommand(parsedAnswers, useYarn, npmTag) {
|
|
|
135
135
|
}
|
|
136
136
|
export async function handler(argv, runConfigCmd = runConfigCommand) {
|
|
137
137
|
const parsedAnswers = await parseAnswers(argv.yes);
|
|
138
|
-
await runConfigCmd(parsedAnswers, argv.
|
|
138
|
+
await runConfigCmd(parsedAnswers, argv.npmTag);
|
|
139
139
|
return {
|
|
140
140
|
success: true,
|
|
141
141
|
parsedAnswers,
|
|
@@ -172,7 +172,7 @@ export async function canAccessConfigPath(configPath) {
|
|
|
172
172
|
* @param {boolean} useYarn parameter set to true if yarn is used
|
|
173
173
|
* @param {Function} runConfigCmd runConfig method to be replaceable for unit testing
|
|
174
174
|
*/
|
|
175
|
-
export async function missingConfigurationPrompt(command, configPath,
|
|
175
|
+
export async function missingConfigurationPrompt(command, configPath, runConfigCmd = runConfigCommand) {
|
|
176
176
|
const message = (`Could not execute "${command}" due to missing configuration, file ` +
|
|
177
177
|
`"${path.parse(configPath).name}[.js/.ts]" not found! ` +
|
|
178
178
|
'Would you like to create one?');
|
|
@@ -192,5 +192,5 @@ export async function missingConfigurationPrompt(command, configPath, useYarn =
|
|
|
192
192
|
return !process.env.VITEST_WORKER_ID && process.exit(0);
|
|
193
193
|
}
|
|
194
194
|
const parsedAnswers = await parseAnswers(false);
|
|
195
|
-
await runConfigCmd(parsedAnswers,
|
|
195
|
+
await runConfigCmd(parsedAnswers, 'latest');
|
|
196
196
|
}
|
|
@@ -3,11 +3,6 @@ import type { InstallCommandArguments } from '../types.js';
|
|
|
3
3
|
export declare const command = "install <type> <name>";
|
|
4
4
|
export declare const desc: string;
|
|
5
5
|
export declare const cmdArgs: {
|
|
6
|
-
readonly yarn: {
|
|
7
|
-
readonly desc: "Install packages using yarn";
|
|
8
|
-
readonly type: "boolean";
|
|
9
|
-
readonly default: false;
|
|
10
|
-
};
|
|
11
6
|
readonly config: {
|
|
12
7
|
readonly desc: "Location of your WDIO configuration (default: wdio.conf.(js|ts|cjs|mjs))";
|
|
13
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,KAAK,EAAE,uBAAuB,EAAoB,MAAM,aAAa,CAAA;AAU5E,eAAO,MAAM,OAAO,0BAA0B,CAAA;AAC9C,eAAO,MAAM,IAAI,QAIN,CAAA;AAEX,eAAO,MAAM,OAAO;;;;CAIV,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI,aAalC,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,uBAAuB,iBAoF1D"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
|
|
5
|
-
import {
|
|
4
|
+
// @ts-expect-error https://github.com/egoist/detect-package-manager/pull/6
|
|
5
|
+
import { detect } from 'detect-package-manager';
|
|
6
|
+
import { getProjectRoot, replaceConfig, findInConfig, addServiceDeps, convertPackageHashToObject } from '../utils.js';
|
|
7
|
+
import { installPackages } from '../install.js';
|
|
6
8
|
import { formatConfigFilePaths, canAccessConfigPath, missingConfigurationPrompt } from './config.js';
|
|
7
9
|
import { SUPPORTED_PACKAGES, CLI_EPILOGUE } from '../constants.js';
|
|
8
10
|
const supportedInstallations = {
|
|
@@ -19,11 +21,6 @@ export const desc = [
|
|
|
19
21
|
'and modifies the wdio.conf.js accordingly.'
|
|
20
22
|
].join(' ');
|
|
21
23
|
export const cmdArgs = {
|
|
22
|
-
yarn: {
|
|
23
|
-
desc: 'Install packages using yarn',
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
default: false
|
|
26
|
-
},
|
|
27
24
|
config: {
|
|
28
25
|
desc: 'Location of your WDIO configuration (default: wdio.conf.(js|ts|cjs|mjs))',
|
|
29
26
|
},
|
|
@@ -44,9 +41,8 @@ export async function handler(argv) {
|
|
|
44
41
|
/**
|
|
45
42
|
* type = service | reporter | framework
|
|
46
43
|
* name = names for the supported service or reporter
|
|
47
|
-
* yarn = optional flag to install package using yarn instead of default yarn
|
|
48
44
|
*/
|
|
49
|
-
const { type, name,
|
|
45
|
+
const { type, name, config } = argv;
|
|
50
46
|
/**
|
|
51
47
|
* verify for supported types via `supportedInstallations` keys
|
|
52
48
|
*/
|
|
@@ -58,9 +54,13 @@ export async function handler(argv) {
|
|
|
58
54
|
/**
|
|
59
55
|
* verify if the name of the `type` is valid
|
|
60
56
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
const options = supportedInstallations[type].map((pkg) => pkg.short);
|
|
58
|
+
if (!options.find((pkg) => pkg === name)) {
|
|
59
|
+
console.log(`Error: ${name} is not a supported ${type}.\n\n` +
|
|
60
|
+
`Available options for a ${type} are:\n` +
|
|
61
|
+
`- ${options.join('\n- ')}`);
|
|
63
62
|
process.exit(0);
|
|
63
|
+
// keep return for unit test purposes
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
const defaultPath = path.resolve(process.cwd(), 'wdio.conf');
|
|
@@ -70,29 +70,33 @@ export async function handler(argv) {
|
|
|
70
70
|
const wdioConfPath = await canAccessConfigPath(wdioConfPathWithNoExtension);
|
|
71
71
|
if (!wdioConfPath) {
|
|
72
72
|
try {
|
|
73
|
-
await missingConfigurationPrompt('install', wdioConfPathWithNoExtension
|
|
73
|
+
await missingConfigurationPrompt('install', wdioConfPathWithNoExtension);
|
|
74
74
|
return handler(argv);
|
|
75
75
|
}
|
|
76
76
|
catch {
|
|
77
77
|
process.exit(1);
|
|
78
|
+
// keep return for unit test purposes
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
const configFile = await fs.readFile(wdioConfPath, { encoding: 'utf-8' });
|
|
82
83
|
const match = findInConfig(configFile, type);
|
|
84
|
+
const projectRoot = await getProjectRoot();
|
|
83
85
|
if (match && match[0].includes(name)) {
|
|
84
86
|
console.log(`The ${type} ${name} is already part of your configuration.`);
|
|
85
87
|
process.exit(0);
|
|
88
|
+
// keep return for unit test purposes
|
|
86
89
|
return;
|
|
87
90
|
}
|
|
88
91
|
const selectedPackage = supportedInstallations[type].find(({ short }) => short === name);
|
|
89
92
|
const pkgsToInstall = selectedPackage ? [selectedPackage.package] : [];
|
|
90
93
|
addServiceDeps(selectedPackage ? [selectedPackage] : [], pkgsToInstall, true);
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
const pm = await detect({ cwd: projectRoot });
|
|
95
|
+
console.log(`Installing "${selectedPackage.package}" using ${pm}.`);
|
|
96
|
+
const success = await installPackages(projectRoot, pkgsToInstall, true);
|
|
97
|
+
if (!success) {
|
|
95
98
|
process.exit(1);
|
|
99
|
+
// keep return for unit test purposes
|
|
96
100
|
return;
|
|
97
101
|
}
|
|
98
102
|
console.log(`Package "${selectedPackage.package}" installed successfully.`);
|
package/build/commands/repl.d.ts
CHANGED
|
@@ -86,6 +86,12 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, str
|
|
|
86
86
|
readonly desc: "Auto compilation options";
|
|
87
87
|
} | {
|
|
88
88
|
readonly desc: "Enable coverage for browser runner";
|
|
89
|
+
} | {
|
|
90
|
+
readonly desc: "Shard tests and execute only the selected shard. Specify in the one-based form like `--shard x/y`, where x is the current and y the total shard.";
|
|
91
|
+
readonly coerce: (shard: string) => {
|
|
92
|
+
current: number;
|
|
93
|
+
total: number;
|
|
94
|
+
};
|
|
89
95
|
}>>>;
|
|
90
96
|
export declare const handler: (argv: ReplCommandArguments) => Promise<void>;
|
|
91
97
|
//# sourceMappingURL=repl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/commands/repl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAK1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAOvD,eAAO,MAAM,OAAO,iCAAiC,CAAA;AACrD,eAAO,MAAM,IAAI,0CAA0C,CAAA;AAC3D,eAAO,MAAM,OAAO,EAAE;KAAG,CAAC,IAAI,MAAM,oBAAoB,CAAC,CAAC,EAAE,OAAO;CAgBzD,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/commands/repl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAK1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAOvD,eAAO,MAAM,OAAO,iCAAiC,CAAA;AACrD,eAAO,MAAM,IAAI,0CAA0C,CAAA;AAC3D,eAAO,MAAM,OAAO,EAAE;KAAG,CAAC,IAAI,MAAM,oBAAoB,CAAC,CAAC,EAAE,OAAO;CAgBzD,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYlC,CAAA;AAED,eAAO,MAAM,OAAO,SAAgB,oBAAoB,kBAUvD,CAAA"}
|
package/build/commands/run.d.ts
CHANGED
|
@@ -105,8 +105,15 @@ export declare const cmdArgs: {
|
|
|
105
105
|
readonly coverage: {
|
|
106
106
|
readonly desc: "Enable coverage for browser runner";
|
|
107
107
|
};
|
|
108
|
+
readonly shard: {
|
|
109
|
+
readonly desc: "Shard tests and execute only the selected shard. Specify in the one-based form like `--shard x/y`, where x is the current and y the total shard.";
|
|
110
|
+
readonly coerce: (shard: string) => {
|
|
111
|
+
current: number;
|
|
112
|
+
total: number;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
108
115
|
};
|
|
109
|
-
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "framework" | "reporters" | "hostname" | "port" | "path" | "baseUrl" | "exclude" | "user" | "key" | "logLevel" | "spec" | "waitforTimeout" | "
|
|
116
|
+
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "framework" | "reporters" | "hostname" | "port" | "path" | "baseUrl" | "exclude" | "user" | "key" | "logLevel" | "spec" | "waitforTimeout" | "bail" | "watch" | "shard" | "mochaOpts" | "jasmineOpts" | "cucumberOpts" | "autoCompileOpts" | "coverage" | "suite" | "multi-run"> & import("yargs").InferredOptionTypes<{
|
|
110
117
|
readonly watch: {
|
|
111
118
|
readonly desc: "Run WebdriverIO in watch mode";
|
|
112
119
|
readonly type: "boolean";
|
|
@@ -209,6 +216,13 @@ export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, "fr
|
|
|
209
216
|
readonly coverage: {
|
|
210
217
|
readonly desc: "Enable coverage for browser runner";
|
|
211
218
|
};
|
|
219
|
+
readonly shard: {
|
|
220
|
+
readonly desc: "Shard tests and execute only the selected shard. Specify in the one-based form like `--shard x/y`, where x is the current and y the total shard.";
|
|
221
|
+
readonly coerce: (shard: string) => {
|
|
222
|
+
current: number;
|
|
223
|
+
total: number;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
212
226
|
}>>;
|
|
213
227
|
export declare function launchWithStdin(wdioConfPath: string, params: Partial<RunCommandArguments>): void;
|
|
214
228
|
export declare function launch(wdioConfPath: string, params: Partial<RunCommandArguments>): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAa1F,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,eAAO,MAAM,OAAO,qBAAqB,CAAA;AAEzC,eAAO,MAAM,IAAI,yEAAyE,CAAA;AAa1F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA6FI,MAAM;;;;;CAQpB,CAAA;AAEV,eAAO,MAAM,OAAO,UAAW,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAVX,MAAM;;;;;GAqB7B,CAAA;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,QAczF;AAED,wBAAsB,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,iBAgBtF;AAMD,wBAAsB,OAAO,CAAC,IAAI,EAAE,mBAAmB,yBAqFtD"}
|
package/build/commands/run.js
CHANGED
|
@@ -108,6 +108,16 @@ export const cmdArgs = {
|
|
|
108
108
|
},
|
|
109
109
|
coverage: {
|
|
110
110
|
desc: 'Enable coverage for browser runner'
|
|
111
|
+
},
|
|
112
|
+
shard: {
|
|
113
|
+
desc: 'Shard tests and execute only the selected shard. Specify in the one-based form like `--shard x/y`, where x is the current and y the total shard.',
|
|
114
|
+
coerce: (shard) => {
|
|
115
|
+
const [current, total] = shard.split('/').map(Number);
|
|
116
|
+
if (Number.isNaN(current) || Number.isNaN(total)) {
|
|
117
|
+
throw new Error('Shard parameter must be in the form `x/y`, where x and y are positive integers.');
|
|
118
|
+
}
|
|
119
|
+
return { current, total };
|
|
120
|
+
}
|
|
111
121
|
}
|
|
112
122
|
};
|
|
113
123
|
export const builder = (yargs) => {
|
|
@@ -115,6 +125,7 @@ export const builder = (yargs) => {
|
|
|
115
125
|
.options(cmdArgs)
|
|
116
126
|
.example('$0 run wdio.conf.js --suite foobar', 'Run suite on testsuite "foobar"')
|
|
117
127
|
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
|
|
128
|
+
.example('$0 run wdio.conf.js --shard 1/4', 'Run only the first shard of 4 shards')
|
|
118
129
|
.example('$0 run wdio.conf.js --mochaOpts.timeout 60000', 'Run suite with custom Mocha timeout')
|
|
119
130
|
.example('$0 run wdio.conf.js --autoCompileOpts.autoCompile=false', 'Disable auto-loading of ts-node or @babel/register')
|
|
120
131
|
.example('$0 run wdio.conf.js --autoCompileOpts.tsNodeOpts.project=./configs/bdd-tsconfig.json', 'Run suite with ts-node using custom tsconfig.json')
|
package/build/constants.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Options } from '@wdio/types';
|
|
1
2
|
import type { Questionnair } from './types.js';
|
|
2
3
|
export declare const pkg: any;
|
|
3
4
|
export declare const CLI_EPILOGUE: string;
|
|
@@ -256,5 +257,6 @@ export declare const QUESTIONNAIRE: ({
|
|
|
256
257
|
when?: undefined;
|
|
257
258
|
})[];
|
|
258
259
|
export declare const COMMUNITY_PACKAGES_WITH_TS_SUPPORT: string[];
|
|
260
|
+
export declare const TESTRUNNER_DEFAULTS: Options.Definition<Options.Testrunner>;
|
|
259
261
|
export {};
|
|
260
262
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAqC,MAAM,aAAa,CAAA;AAQ7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,eAAO,MAAM,GAAG,KAA6B,CAAA;AAE7C,eAAO,MAAM,YAAY,QAAqE,CAAA;AAE9F,eAAO,MAAM,mBAAmB,8HAI/B,CAAA;AAED,eAAO,MAAM,+BAA+B,UAA2C,CAAA;AACvF,eAAO,MAAM,0BAA0B;oBAAqE,MAAM;eAAa,MAAM;eAAa,MAAM;YAYvJ,CAAA;AAED,eAAO,MAAM,6BAA6B,8EAGzC,CAAA;AAED,eAAO,MAAM,iCAAiC,8CAG7C,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,cAAc;;;;CAI1B,CAAA;AAED,eAAO,MAAM,UAAU;;;;CAItB,CAAA;AAED,oBAAY,eAAe;IACvB,KAAK,gCAAgC;IACrC,EAAE,iDAAiD;IACnD,GAAG,QAAQ;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;CAsF9B,CAAA;AAED,eAAO,MAAM,gCAAgC;;;;;;IAS5C,CAAA;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAM3D,CAAA;AAED,oBAAY,aAAa;IACrB,KAAK,wBAAwB;IAC7B,UAAU,kCAAkC;IAC5C,SAAS,kCAAkC;IAC3C,YAAY,oCAAoC;IAChD,YAAY,uEA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createRequire } from 'node:module';
|
|
4
|
-
import {
|
|
4
|
+
import { HOOK_DEFINITION } from '@wdio/utils';
|
|
5
|
+
import { detectCompiler, getDefaultFiles, convertPackageHashToObject, getProjectRoot, } from './utils.js';
|
|
5
6
|
const require = createRequire(import.meta.url);
|
|
6
7
|
export const pkg = require('../package.json');
|
|
7
8
|
export const CLI_EPILOGUE = `Documentation: https://webdriver.io\n@wdio/cli (v${pkg.version})`;
|
|
@@ -86,9 +87,9 @@ export const SUPPORTED_PACKAGES = {
|
|
|
86
87
|
{ name: 'html-nice', value: 'wdio-html-nice-reporter$--$html-nice' },
|
|
87
88
|
{ name: 'slack', value: '@moroo/wdio-slack-reporter$--$slack' },
|
|
88
89
|
{ name: 'teamcity', value: 'wdio-teamcity-reporter$--$teamcity' },
|
|
89
|
-
{ name: 'delta', value: '@delta-reporter/wdio-delta-reporter-service' },
|
|
90
|
+
{ name: 'delta', value: '@delta-reporter/wdio-delta-reporter-service$--$delta' },
|
|
90
91
|
{ name: 'testrail', value: '@wdio/testrail-reporter$--$testrail' },
|
|
91
|
-
{ name: 'light', value: 'wdio-light-reporter
|
|
92
|
+
{ name: 'light', value: 'wdio-light-reporter$--$light' }
|
|
92
93
|
],
|
|
93
94
|
plugin: [
|
|
94
95
|
{ name: 'wait-for: utilities that provide functionalities to wait for certain conditions till a defined task is complete.\n > https://www.npmjs.com/package/wdio-wait-for', value: 'wdio-wait-for$--$wait-for' },
|
|
@@ -117,7 +118,7 @@ export const SUPPORTED_PACKAGES = {
|
|
|
117
118
|
{ name: 'docker', value: 'wdio-docker-service$--$docker' },
|
|
118
119
|
{ name: 'ui5', value: 'wdio-ui5-service$--$ui5' },
|
|
119
120
|
{ name: 'wiremock', value: 'wdio-wiremock-service$--$wiremock' },
|
|
120
|
-
{ name: 'ng-apimock', value: 'wdio-ng-apimock-service
|
|
121
|
+
{ name: 'ng-apimock', value: 'wdio-ng-apimock-service$--$ng-apimock' },
|
|
121
122
|
{ name: 'slack', value: 'wdio-slack-service$--$slack' },
|
|
122
123
|
{ name: 'cucumber-viewport-logger', value: 'wdio-cucumber-viewport-logger-service$--$cucumber-viewport-logger' },
|
|
123
124
|
{ name: 'intercept', value: 'wdio-intercept-service$--$intercept' },
|
|
@@ -493,8 +494,7 @@ export const QUESTIONNAIRE = [{
|
|
|
493
494
|
name: 'serenityLibPath',
|
|
494
495
|
message: 'What should be the location of your Serenity/JS Screenplay Pattern library?',
|
|
495
496
|
default: /* istanbul ignore next */ async (answers) => {
|
|
496
|
-
const
|
|
497
|
-
const projectRootDir = getProjectRoot(answers, projectProps);
|
|
497
|
+
const projectRootDir = await getProjectRoot(answers);
|
|
498
498
|
const specsDir = path.resolve(projectRootDir, path.dirname(answers.specs || '').replace(/\*\*$/, ''));
|
|
499
499
|
return path.resolve(specsDir, '..', 'serenity');
|
|
500
500
|
},
|
|
@@ -612,3 +612,255 @@ export const COMMUNITY_PACKAGES_WITH_TS_SUPPORT = [
|
|
|
612
612
|
'wdio-vite-service',
|
|
613
613
|
'wdio-gmail-service'
|
|
614
614
|
];
|
|
615
|
+
export const TESTRUNNER_DEFAULTS = {
|
|
616
|
+
/**
|
|
617
|
+
* Define specs for test execution. You can either specify a glob
|
|
618
|
+
* pattern to match multiple files at once or wrap a glob or set of
|
|
619
|
+
* paths into an array to run them within a single worker process.
|
|
620
|
+
*/
|
|
621
|
+
specs: {
|
|
622
|
+
type: 'object',
|
|
623
|
+
validate: (param) => {
|
|
624
|
+
if (!Array.isArray(param)) {
|
|
625
|
+
throw new Error('the "specs" option needs to be a list of strings');
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
/**
|
|
630
|
+
* exclude specs from test execution
|
|
631
|
+
*/
|
|
632
|
+
exclude: {
|
|
633
|
+
type: 'object',
|
|
634
|
+
validate: (param) => {
|
|
635
|
+
if (!Array.isArray(param)) {
|
|
636
|
+
throw new Error('the "exclude" option needs to be a list of strings');
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
/**
|
|
641
|
+
* key/value definition of suites (named by key) and a list of specs as value
|
|
642
|
+
* to specify a specific set of tests to execute
|
|
643
|
+
*/
|
|
644
|
+
suites: {
|
|
645
|
+
type: 'object'
|
|
646
|
+
},
|
|
647
|
+
/**
|
|
648
|
+
* Project root directory path.
|
|
649
|
+
*/
|
|
650
|
+
rootDir: {
|
|
651
|
+
type: 'string'
|
|
652
|
+
},
|
|
653
|
+
/**
|
|
654
|
+
* If you only want to run your tests until a specific amount of tests have failed use
|
|
655
|
+
* bail (default is 0 - don't bail, run all tests).
|
|
656
|
+
*/
|
|
657
|
+
bail: {
|
|
658
|
+
type: 'number',
|
|
659
|
+
default: 0
|
|
660
|
+
},
|
|
661
|
+
/**
|
|
662
|
+
* supported test framework by wdio testrunner
|
|
663
|
+
*/
|
|
664
|
+
framework: {
|
|
665
|
+
type: 'string'
|
|
666
|
+
},
|
|
667
|
+
/**
|
|
668
|
+
* capabilities of WebDriver sessions
|
|
669
|
+
*/
|
|
670
|
+
capabilities: {
|
|
671
|
+
type: 'object',
|
|
672
|
+
validate: (param) => {
|
|
673
|
+
/**
|
|
674
|
+
* should be an object
|
|
675
|
+
*/
|
|
676
|
+
if (!Array.isArray(param)) {
|
|
677
|
+
if (typeof param === 'object') {
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
throw new Error('the "capabilities" options needs to be an object or a list of objects');
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* or an array of objects
|
|
684
|
+
*/
|
|
685
|
+
for (const option of param) {
|
|
686
|
+
if (typeof option === 'object') { // Check does not work recursively
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
throw new Error('expected every item of a list of capabilities to be of type object');
|
|
690
|
+
}
|
|
691
|
+
return true;
|
|
692
|
+
},
|
|
693
|
+
required: true
|
|
694
|
+
},
|
|
695
|
+
/**
|
|
696
|
+
* list of reporters to use, a reporter can be either a string or an object with
|
|
697
|
+
* reporter options, e.g.:
|
|
698
|
+
* [
|
|
699
|
+
* 'dot',
|
|
700
|
+
* {
|
|
701
|
+
* name: 'spec',
|
|
702
|
+
* outputDir: __dirname + '/reports'
|
|
703
|
+
* }
|
|
704
|
+
* ]
|
|
705
|
+
*/
|
|
706
|
+
reporters: {
|
|
707
|
+
type: 'object',
|
|
708
|
+
validate: (param) => {
|
|
709
|
+
/**
|
|
710
|
+
* option must be an array
|
|
711
|
+
*/
|
|
712
|
+
if (!Array.isArray(param)) {
|
|
713
|
+
throw new Error('the "reporters" options needs to be a list of strings');
|
|
714
|
+
}
|
|
715
|
+
const isValidReporter = (option) => ((typeof option === 'string') ||
|
|
716
|
+
(typeof option === 'function'));
|
|
717
|
+
/**
|
|
718
|
+
* array elements must be:
|
|
719
|
+
*/
|
|
720
|
+
for (const option of param) {
|
|
721
|
+
/**
|
|
722
|
+
* either a string or a function (custom reporter)
|
|
723
|
+
*/
|
|
724
|
+
if (isValidReporter(option)) {
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* or an array with the name of the reporter as first element and the options
|
|
729
|
+
* as second element
|
|
730
|
+
*/
|
|
731
|
+
if (Array.isArray(option) &&
|
|
732
|
+
typeof option[1] === 'object' &&
|
|
733
|
+
isValidReporter(option[0])) {
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
throw new Error('a reporter should be either a string in the format "wdio-<reportername>-reporter" ' +
|
|
737
|
+
'or a function/class. Please see the docs for more information on custom reporters ' +
|
|
738
|
+
'(https://webdriver.io/docs/customreporter)');
|
|
739
|
+
}
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
/**
|
|
744
|
+
* set of WDIO services to use
|
|
745
|
+
*/
|
|
746
|
+
services: {
|
|
747
|
+
type: 'object',
|
|
748
|
+
validate: (param) => {
|
|
749
|
+
/**
|
|
750
|
+
* should be an array
|
|
751
|
+
*/
|
|
752
|
+
if (!Array.isArray(param)) {
|
|
753
|
+
throw new Error('the "services" options needs to be a list of strings and/or arrays');
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* with arrays and/or strings
|
|
757
|
+
*/
|
|
758
|
+
for (const option of param) {
|
|
759
|
+
if (!Array.isArray(option)) {
|
|
760
|
+
if (typeof option === 'string') {
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
throw new Error('the "services" options needs to be a list of strings and/or arrays');
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
return true;
|
|
767
|
+
},
|
|
768
|
+
default: []
|
|
769
|
+
},
|
|
770
|
+
/**
|
|
771
|
+
* Node arguments to specify when launching child processes
|
|
772
|
+
*/
|
|
773
|
+
execArgv: {
|
|
774
|
+
type: 'object',
|
|
775
|
+
validate: (param) => {
|
|
776
|
+
if (!Array.isArray(param)) {
|
|
777
|
+
throw new Error('the "execArgv" options needs to be a list of strings');
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
default: []
|
|
781
|
+
},
|
|
782
|
+
/**
|
|
783
|
+
* amount of instances to be allowed to run in total
|
|
784
|
+
*/
|
|
785
|
+
maxInstances: {
|
|
786
|
+
type: 'number'
|
|
787
|
+
},
|
|
788
|
+
/**
|
|
789
|
+
* amount of instances to be allowed to run per capability
|
|
790
|
+
*/
|
|
791
|
+
maxInstancesPerCapability: {
|
|
792
|
+
type: 'number'
|
|
793
|
+
},
|
|
794
|
+
/**
|
|
795
|
+
* whether or not testrunner should inject `browser`, `$` and `$$` as
|
|
796
|
+
* global environment variables
|
|
797
|
+
*/
|
|
798
|
+
injectGlobals: {
|
|
799
|
+
type: 'boolean'
|
|
800
|
+
},
|
|
801
|
+
/**
|
|
802
|
+
* The number of times to retry the entire specfile when it fails as a whole
|
|
803
|
+
*/
|
|
804
|
+
specFileRetries: {
|
|
805
|
+
type: 'number',
|
|
806
|
+
default: 0
|
|
807
|
+
},
|
|
808
|
+
/**
|
|
809
|
+
* Delay in seconds between the spec file retry attempts
|
|
810
|
+
*/
|
|
811
|
+
specFileRetriesDelay: {
|
|
812
|
+
type: 'number',
|
|
813
|
+
default: 0
|
|
814
|
+
},
|
|
815
|
+
/**
|
|
816
|
+
* Whether or not retried spec files should be retried immediately or deferred to the end of the queue
|
|
817
|
+
*/
|
|
818
|
+
specFileRetriesDeferred: {
|
|
819
|
+
type: 'boolean',
|
|
820
|
+
default: true
|
|
821
|
+
},
|
|
822
|
+
/**
|
|
823
|
+
* list of strings to watch of `wdio` command is called with `--watch` flag
|
|
824
|
+
*/
|
|
825
|
+
filesToWatch: {
|
|
826
|
+
type: 'object',
|
|
827
|
+
validate: (param) => {
|
|
828
|
+
if (!Array.isArray(param)) {
|
|
829
|
+
throw new Error('the "filesToWatch" option needs to be a list of strings');
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
shard: {
|
|
834
|
+
type: 'object',
|
|
835
|
+
validate: (param) => {
|
|
836
|
+
if (typeof param !== 'object') {
|
|
837
|
+
throw new Error('the "shard" options needs to be an object');
|
|
838
|
+
}
|
|
839
|
+
const p = param;
|
|
840
|
+
if (typeof p.current !== 'number' || typeof p.total !== 'number') {
|
|
841
|
+
throw new Error('the "shard" option needs to have "current" and "total" properties with number values');
|
|
842
|
+
}
|
|
843
|
+
if (p.current < 0 || p.current > p.total) {
|
|
844
|
+
throw new Error('the "shard.current" value has to be between 0 and "shard.total"');
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
/**
|
|
849
|
+
* hooks
|
|
850
|
+
*/
|
|
851
|
+
onPrepare: HOOK_DEFINITION,
|
|
852
|
+
onWorkerStart: HOOK_DEFINITION,
|
|
853
|
+
onWorkerEnd: HOOK_DEFINITION,
|
|
854
|
+
before: HOOK_DEFINITION,
|
|
855
|
+
beforeSession: HOOK_DEFINITION,
|
|
856
|
+
beforeSuite: HOOK_DEFINITION,
|
|
857
|
+
beforeHook: HOOK_DEFINITION,
|
|
858
|
+
beforeTest: HOOK_DEFINITION,
|
|
859
|
+
afterTest: HOOK_DEFINITION,
|
|
860
|
+
afterHook: HOOK_DEFINITION,
|
|
861
|
+
afterSuite: HOOK_DEFINITION,
|
|
862
|
+
afterSession: HOOK_DEFINITION,
|
|
863
|
+
after: HOOK_DEFINITION,
|
|
864
|
+
onComplete: HOOK_DEFINITION,
|
|
865
|
+
onReload: HOOK_DEFINITION
|
|
866
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type PM } from 'detect-package-manager';
|
|
2
|
+
export declare function installPackages(cwd: string, packages: string[], dev: boolean): Promise<boolean>;
|
|
3
|
+
export declare function getInstallCommand(pm: PM, packages: string[], dev: boolean): string;
|
|
4
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,EAAE,EAAE,MAAM,wBAAwB,CAAA;AAgBxD,wBAAsB,eAAe,CAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,oBAwBnF;AAED,wBAAgB,iBAAiB,CAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,UAG1E"}
|
package/build/install.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
// @ts-expect-error // @ts-expect-error https://github.com/egoist/detect-package-manager/pull/6
|
|
3
|
+
import { detect } from 'detect-package-manager';
|
|
4
|
+
const installCommand = {
|
|
5
|
+
npm: 'install',
|
|
6
|
+
pnpm: 'add',
|
|
7
|
+
yarn: 'add',
|
|
8
|
+
bun: 'install'
|
|
9
|
+
};
|
|
10
|
+
const devFlag = {
|
|
11
|
+
npm: '--save-dev',
|
|
12
|
+
pnpm: '--save-dev',
|
|
13
|
+
yarn: '--dev',
|
|
14
|
+
bun: '--dev'
|
|
15
|
+
};
|
|
16
|
+
export async function installPackages(cwd, packages, dev) {
|
|
17
|
+
const pm = await detect({ cwd });
|
|
18
|
+
const devParam = dev ? devFlag[pm] : '';
|
|
19
|
+
console.log('\n');
|
|
20
|
+
const p = execa(pm, [installCommand[pm], ...packages, devParam], {
|
|
21
|
+
cwd,
|
|
22
|
+
stdout: process.stdout,
|
|
23
|
+
stderr: process.stderr
|
|
24
|
+
});
|
|
25
|
+
const { stdout, stderr, exitCode } = await p;
|
|
26
|
+
if (exitCode !== 0) {
|
|
27
|
+
const cmd = getInstallCommand(pm, packages, dev);
|
|
28
|
+
const customError = ('⚠️ An unknown error happened! Please retry ' +
|
|
29
|
+
`installing dependencies via "${cmd}"\n\n` +
|
|
30
|
+
`Error: ${stderr || stdout || 'unknown'}`);
|
|
31
|
+
console.error(customError);
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
export function getInstallCommand(pm, packages, dev) {
|
|
37
|
+
const devParam = dev ? devFlag[pm] : '';
|
|
38
|
+
return `${pm} ${installCommand[pm]} ${packages.join(' ')} ${devParam}`;
|
|
39
|
+
}
|
package/build/interface.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import type { Options, Workers } from '@wdio/types';
|
|
4
4
|
import { HookError } from './utils.js';
|
|
@@ -17,6 +17,7 @@ interface CLIInterfaceEvent {
|
|
|
17
17
|
error?: TestError;
|
|
18
18
|
}
|
|
19
19
|
export default class WDIOCLInterface extends EventEmitter {
|
|
20
|
+
#private;
|
|
20
21
|
private _config;
|
|
21
22
|
totalWorkerCnt: number;
|
|
22
23
|
private _isWatchMode;
|
package/build/interface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAStC,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAAY
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAStC,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,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AAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,GAAG,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IASrE;;OAEG;IACH,QAAQ,CAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IA2BrF;;OAEG;IACH,GAAG,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAMnB,YAAY,CAAE,KAAK,EAAE,KAAK,GAAG,SAAS;IAOtC;;OAEG;IACH,SAAS,CAAE,KAAK,EAAE,iBAAiB;IAiDnC,aAAa;IAgBb,cAAc;IAYd,YAAY;IAgBZ,QAAQ;CAIX"}
|
package/build/interface.js
CHANGED
|
@@ -49,6 +49,9 @@ export default class WDIOCLInterface extends EventEmitter {
|
|
|
49
49
|
this.setup();
|
|
50
50
|
this.onStart();
|
|
51
51
|
}
|
|
52
|
+
#hasShard() {
|
|
53
|
+
return this._config.shard && this._config.shard.total !== 1;
|
|
54
|
+
}
|
|
52
55
|
setup() {
|
|
53
56
|
this._jobs = new Map();
|
|
54
57
|
this._start = new Date();
|
|
@@ -68,7 +71,10 @@ export default class WDIOCLInterface extends EventEmitter {
|
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
73
|
onStart() {
|
|
71
|
-
|
|
74
|
+
const shardNote = this.#hasShard()
|
|
75
|
+
? ` (Shard ${this._config.shard.current} of ${this._config.shard.total})`
|
|
76
|
+
: '';
|
|
77
|
+
this.log(chalk.bold(`\nExecution of ${chalk.blue(this.totalWorkerCnt)} workers${shardNote} started at`), this._start.toISOString());
|
|
72
78
|
if (this._inDebugMode) {
|
|
73
79
|
this.log(chalk.bgYellow.black('DEBUG mode enabled!'));
|
|
74
80
|
}
|
|
@@ -243,7 +249,9 @@ export default class WDIOCLInterface extends EventEmitter {
|
|
|
243
249
|
const failed = this.result.failed ? chalk.red(this.result.failed, 'failed') + ', ' : '';
|
|
244
250
|
const skipped = this._skippedSpecs > 0 ? chalk.gray(this._skippedSpecs, 'skipped') + ', ' : '';
|
|
245
251
|
const percentCompleted = totalJobs ? Math.round(this.result.finished / totalJobs * 100) : 0;
|
|
246
|
-
return this.log('\nSpec Files:\t', chalk.green(this.result.passed, 'passed') + ', ' + retries + failed + skipped + totalJobs, 'total', `(${percentCompleted}% completed)`, 'in', elapsed,
|
|
252
|
+
return this.log('\nSpec Files:\t', chalk.green(this.result.passed, 'passed') + ', ' + retries + failed + skipped + totalJobs, 'total', `(${percentCompleted}% completed)`, 'in', elapsed, this.#hasShard()
|
|
253
|
+
? `\nShard:\t\t ${this._config.shard.current} / ${this._config.shard.total}`
|
|
254
|
+
: undefined, '\n');
|
|
247
255
|
}
|
|
248
256
|
finalise() {
|
|
249
257
|
this.printReporters();
|
package/build/launcher.d.ts
CHANGED
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,WAAW,MAAM,gBAAgB,CAAA;AAIxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAkBrD,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,cAAM,QAAQ;IAkBN,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY;IAnBjB,YAAY,EAAE,YAAY,CAAA;IAC1B,aAAa,UAAQ;IACrB,qBAAqB,UAAQ;IAC7B,MAAM,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAA;IAChC,SAAS,CAAC,EAAE,WAAW,CAAA;IAE9B,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,wBAAwB,CAAQ;IACxC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,SAAS,CAAC,CAA4B;IAC9C,OAAO,CAAC,QAAQ,CAAC,CAAU;gBAGf,eAAe,EAAE,MAAM,EACvB,KAAK,GAAE,OAAO,CAAC,mBAAmB,CAAM,EACxC,YAAY,UAAQ;IAKhC;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;IAsHxC;;OAEG;IACH,OAAO,CAAC,QAAQ;IA+EhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAmEjB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAIpC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;;;;;OAMG;YACW,cAAc;IA8F5B,OAAO,CAAC,gBAAgB;IAWxB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;OAMG;YACW,WAAW;IA0DzB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAcpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAG7B;AAED,eAAe,QAAQ,CAAA"}
|
package/build/launcher.js
CHANGED
|
@@ -2,10 +2,13 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import exitHook from 'async-exit-hook';
|
|
4
4
|
import logger from '@wdio/logger';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { validateConfig } from '@wdio/config';
|
|
6
|
+
import { ConfigParser } from '@wdio/config/node';
|
|
7
|
+
import { initialisePlugin, initialiseLauncherService, sleep } from '@wdio/utils';
|
|
8
|
+
import { setupDriver, setupBrowser } from '@wdio/utils/node';
|
|
7
9
|
import CLInterface from './interface.js';
|
|
8
10
|
import { runLauncherHook, runOnCompleteHook, runServiceHook } from './utils.js';
|
|
11
|
+
import { TESTRUNNER_DEFAULTS } from './constants.js';
|
|
9
12
|
const log = logger('@wdio/cli:launcher');
|
|
10
13
|
class Launcher {
|
|
11
14
|
_configFilePath;
|
|
@@ -46,6 +49,7 @@ class Launcher {
|
|
|
46
49
|
this.isParallelMultiremote = Array.isArray(capabilities) &&
|
|
47
50
|
capabilities.every(cap => Object.values(cap).length > 0 && Object.values(cap).every(c => typeof c === 'object' && c.capabilities));
|
|
48
51
|
this.isMultiremote = this.isParallelMultiremote || !Array.isArray(capabilities);
|
|
52
|
+
validateConfig(TESTRUNNER_DEFAULTS, { ...config, capabilities });
|
|
49
53
|
if (config.outputDir) {
|
|
50
54
|
await fs.mkdir(path.join(config.outputDir), { recursive: true });
|
|
51
55
|
process.env.WDIO_LOG_PATH = path.join(config.outputDir, 'wdio.log');
|
|
@@ -192,6 +196,11 @@ class Launcher {
|
|
|
192
196
|
* fail if no specs were found or specified
|
|
193
197
|
*/
|
|
194
198
|
if (Object.values(this._schedule).reduce((specCnt, schedule) => specCnt + schedule.specs.length, 0) === 0) {
|
|
199
|
+
const { total, current } = config.shard;
|
|
200
|
+
if (total > 1) {
|
|
201
|
+
log.info(`No specs to execute in shard ${current}/${total}, exiting!`);
|
|
202
|
+
return resolve(0);
|
|
203
|
+
}
|
|
195
204
|
log.error('No specs found to run, exiting with failure');
|
|
196
205
|
return resolve(1);
|
|
197
206
|
}
|
package/build/types.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export interface RunCommandArguments {
|
|
|
79
79
|
logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
80
80
|
bail?: number;
|
|
81
81
|
baseUrl?: string;
|
|
82
|
+
shard?: Options.ShardOptions;
|
|
82
83
|
waitforTimeout?: number;
|
|
83
84
|
framework?: string;
|
|
84
85
|
reporters?: Reporters.ReporterEntry[];
|
|
@@ -103,7 +104,6 @@ export interface ReplCommandArguments {
|
|
|
103
104
|
capabilities: string;
|
|
104
105
|
}
|
|
105
106
|
export interface InstallCommandArguments {
|
|
106
|
-
yarn: boolean;
|
|
107
107
|
config?: string;
|
|
108
108
|
type: 'service' | 'reporter' | 'framework' | 'plugin';
|
|
109
109
|
name: string;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAE5G,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,iBAAiB,CAAC,EAAE,uBAAuB,CAAA;IAC3C,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CA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OAAO,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACjB;AAED,4CAA4C;AAC5C,MAAM,MAAM,gBAAgB,CAAC,CAAC,IACxB,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GACpC,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAC3B,KAAK,iBAAiB,CAAC,CAAC,IAClB,YAAY,GACZ,CAAC,YAAY,EAAE,GAAG,CAAC,GACnB,cAAc,CAAC,CAAC,CAAC,CAAC;AACxB,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7C,KAAK,cAAc,CAAC,CAAC,IAAI;KACpB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AACF,KAAK,OAAO,GAAG,OAAO,CAAC;AAEvB,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,qBAAqB,CAAA;CACrC"}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { SpawnOptions } from 'node:child_process';
|
|
3
3
|
import { SevereServiceError } from 'webdriverio';
|
|
4
4
|
import type { Capabilities, Options, Services } from '@wdio/types';
|
|
@@ -71,13 +71,6 @@ export declare function getCapabilities(arg: ReplCommandArguments): Promise<{
|
|
|
71
71
|
browserName: string;
|
|
72
72
|
};
|
|
73
73
|
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Get project root directory based on questionair answers
|
|
76
|
-
* @param answers questionair answers
|
|
77
|
-
* @param projectProps project properties received via `getProjectProps`
|
|
78
|
-
* @returns project root path
|
|
79
|
-
*/
|
|
80
|
-
export declare function getProjectRoot(answers: Questionnair, projectProps?: ProjectProps): string;
|
|
81
74
|
/**
|
|
82
75
|
* Checks if certain directory has babel configuration files
|
|
83
76
|
* @param rootDir directory where this function checks for Babel signs
|
|
@@ -128,7 +121,7 @@ export declare function createPackageJSON(parsedAnswers: ParsedAnswers): Promise
|
|
|
128
121
|
/**
|
|
129
122
|
* run npm install only if required by the user
|
|
130
123
|
*/
|
|
131
|
-
export declare function npmInstall(parsedAnswers: ParsedAnswers,
|
|
124
|
+
export declare function npmInstall(parsedAnswers: ParsedAnswers, npmTag: string): Promise<void>;
|
|
132
125
|
/**
|
|
133
126
|
* add ts-node if TypeScript is desired but not installed
|
|
134
127
|
*/
|
|
@@ -138,6 +131,13 @@ export declare function setupTypeScript(parsedAnswers: ParsedAnswers): Promise<v
|
|
|
138
131
|
*/
|
|
139
132
|
export declare function setupBabel(parsedAnswers: ParsedAnswers): Promise<void>;
|
|
140
133
|
export declare function createWDIOConfig(parsedAnswers: ParsedAnswers): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Get project root directory based on questionair answers
|
|
136
|
+
* @param answers questionair answers
|
|
137
|
+
* @param projectProps project properties received via `getProjectProps`
|
|
138
|
+
* @returns project root path
|
|
139
|
+
*/
|
|
140
|
+
export declare function getProjectRoot(parsedAnswers?: Questionnair): Promise<string>;
|
|
141
141
|
export declare function createWDIOScript(parsedAnswers: ParsedAnswers): Promise<boolean>;
|
|
142
142
|
export declare function runAppiumInstaller(parsedAnswers: ParsedAnswers): Promise<void | import("execa").ExecaReturnValue<string>>;
|
|
143
143
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src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B,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAYlG;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAkB5F;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,YAAY,iBAehF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,aAAa,EAAE,aAAa,8BAgCnE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,iBAwF5E;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,aAAa,iBAwGjE;AAOD;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,iBA4C5D;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,iBAmBlE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAE,aAAa,CAAC,EAAE,YAAY,mBASjE;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,oBAoClE;AAED,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,aAAa,4DAoBpE"}
|
package/build/utils.js
CHANGED
|
@@ -9,13 +9,15 @@ import inquirer from 'inquirer';
|
|
|
9
9
|
import pickBy from 'lodash.pickby';
|
|
10
10
|
import logger from '@wdio/logger';
|
|
11
11
|
import readDir from 'recursive-readdir';
|
|
12
|
-
import yarnInstall from 'yarn-install';
|
|
13
12
|
import { $ } from 'execa';
|
|
13
|
+
// @ts-expect-error // @ts-expect-error https://github.com/egoist/detect-package-manager/pull/6
|
|
14
|
+
import { detect } from 'detect-package-manager';
|
|
14
15
|
import { readPackageUp } from 'read-pkg-up';
|
|
15
16
|
import { resolve } from 'import-meta-resolve';
|
|
16
17
|
import { SevereServiceError } from 'webdriverio';
|
|
17
|
-
import { ConfigParser } from '@wdio/config';
|
|
18
|
+
import { ConfigParser } from '@wdio/config/node';
|
|
18
19
|
import { CAPABILITY_KEYS } from '@wdio/protocols';
|
|
20
|
+
import { installPackages, getInstallCommand } from './install.js';
|
|
19
21
|
import { ANDROID_CONFIG, CompilerOptions, DEPENDENCIES_INSTALLATION_MESSAGE, IOS_CONFIG, pkg, QUESTIONNAIRE, TESTING_LIBRARY_PACKAGES, COMMUNITY_PACKAGES_WITH_TS_SUPPORT, usesSerenity, } from './constants.js';
|
|
20
22
|
import { EjsHelpers } from './templates/EjsHelpers.js';
|
|
21
23
|
const log = logger('@wdio/cli:utils');
|
|
@@ -269,18 +271,6 @@ export async function getCapabilities(arg) {
|
|
|
269
271
|
}
|
|
270
272
|
return { capabilities: { browserName: arg.option } };
|
|
271
273
|
}
|
|
272
|
-
/**
|
|
273
|
-
* Get project root directory based on questionair answers
|
|
274
|
-
* @param answers questionair answers
|
|
275
|
-
* @param projectProps project properties received via `getProjectProps`
|
|
276
|
-
* @returns project root path
|
|
277
|
-
*/
|
|
278
|
-
export function getProjectRoot(answers, projectProps) {
|
|
279
|
-
return (answers.projectRoot ||
|
|
280
|
-
(typeof projectProps === 'undefined'
|
|
281
|
-
? process.cwd()
|
|
282
|
-
: projectProps.path));
|
|
283
|
-
}
|
|
284
274
|
/**
|
|
285
275
|
* Checks if certain directory has babel configuration files
|
|
286
276
|
* @param rootDir directory where this function checks for Babel signs
|
|
@@ -298,8 +288,7 @@ export function hasBabelConfig(rootDir) {
|
|
|
298
288
|
* detect if project has a compiler file
|
|
299
289
|
*/
|
|
300
290
|
export async function detectCompiler(answers) {
|
|
301
|
-
const
|
|
302
|
-
const root = getProjectRoot(answers, projectProps);
|
|
291
|
+
const root = await getProjectRoot(answers);
|
|
303
292
|
const rootTSConfigExist = await fs.access(path.resolve(root, 'tsconfig.json')).then(() => true, () => false);
|
|
304
293
|
return (await hasBabelConfig(root))
|
|
305
294
|
? CompilerOptions.Babel // default to Babel
|
|
@@ -506,8 +495,7 @@ export function getPathForFileGeneration(answers, projectRootDir) {
|
|
|
506
495
|
};
|
|
507
496
|
}
|
|
508
497
|
export async function getDefaultFiles(answers, pattern) {
|
|
509
|
-
const
|
|
510
|
-
const rootdir = getProjectRoot(answers, projectProps);
|
|
498
|
+
const rootdir = await getProjectRoot(answers);
|
|
511
499
|
const presetPackage = convertPackageHashToObject(answers.preset || '');
|
|
512
500
|
const isJSX = TSX_BASED_FRAMEWORKS.includes(presetPackage.short || '');
|
|
513
501
|
const val = pattern.endsWith('.feature')
|
|
@@ -608,7 +596,7 @@ export async function createPackageJSON(parsedAnswers) {
|
|
|
608
596
|
/**
|
|
609
597
|
* run npm install only if required by the user
|
|
610
598
|
*/
|
|
611
|
-
export function npmInstall(parsedAnswers,
|
|
599
|
+
export async function npmInstall(parsedAnswers, npmTag) {
|
|
612
600
|
const servicePackages = parsedAnswers.rawAnswers.services.map((service) => convertPackageHashToObject(service));
|
|
613
601
|
const presetPackage = convertPackageHashToObject(parsedAnswers.rawAnswers.preset || '');
|
|
614
602
|
/**
|
|
@@ -671,19 +659,17 @@ export function npmInstall(parsedAnswers, useYarn, npmTag) {
|
|
|
671
659
|
* update package version if CLI is a pre release
|
|
672
660
|
*/
|
|
673
661
|
parsedAnswers.packagesToInstall = specifyVersionIfNeeded(parsedAnswers.packagesToInstall, pkg.version, npmTag);
|
|
662
|
+
const cwd = await getProjectRoot(parsedAnswers);
|
|
663
|
+
const pm = await detect({ cwd });
|
|
674
664
|
if (parsedAnswers.npmInstall) {
|
|
675
|
-
console.log(
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
`installing dependencies via "${useYarn ? 'yarn add --dev' : 'npm i --save-dev'} ` +
|
|
680
|
-
`${parsedAnswers.packagesToInstall.join(' ')}"\n\nError: ${result.stderr || 'unknown'}`;
|
|
681
|
-
console.error(customError);
|
|
665
|
+
console.log(`Installing packages using ${pm}:\n-${parsedAnswers.packagesToInstall.join('\n- ')}`);
|
|
666
|
+
const success = await installPackages(cwd, parsedAnswers.packagesToInstall, true);
|
|
667
|
+
if (success) {
|
|
668
|
+
console.log(chalk.green.bold('✔ Success!\n'));
|
|
682
669
|
}
|
|
683
|
-
console.log(chalk.green.bold('✔ Success!\n'));
|
|
684
670
|
}
|
|
685
671
|
else {
|
|
686
|
-
const installationCommand =
|
|
672
|
+
const installationCommand = getInstallCommand(pm, parsedAnswers.packagesToInstall, true);
|
|
687
673
|
console.log(util.format(DEPENDENCIES_INSTALLATION_MESSAGE, installationCommand));
|
|
688
674
|
}
|
|
689
675
|
}
|
|
@@ -844,9 +830,24 @@ export async function createWDIOConfig(parsedAnswers) {
|
|
|
844
830
|
throw new Error(`⚠️ Couldn't write config file: ${err.stack}`);
|
|
845
831
|
}
|
|
846
832
|
}
|
|
833
|
+
/**
|
|
834
|
+
* Get project root directory based on questionair answers
|
|
835
|
+
* @param answers questionair answers
|
|
836
|
+
* @param projectProps project properties received via `getProjectProps`
|
|
837
|
+
* @returns project root path
|
|
838
|
+
*/
|
|
839
|
+
export async function getProjectRoot(parsedAnswers) {
|
|
840
|
+
const root = (await getProjectProps())?.path;
|
|
841
|
+
if (!root) {
|
|
842
|
+
throw new Error('Could not find project root directory with a package.json');
|
|
843
|
+
}
|
|
844
|
+
return !parsedAnswers || parsedAnswers.projectRootCorrect
|
|
845
|
+
? root
|
|
846
|
+
: parsedAnswers.projectRoot || process.cwd();
|
|
847
|
+
}
|
|
847
848
|
export async function createWDIOScript(parsedAnswers) {
|
|
848
|
-
const
|
|
849
|
-
const pathToWdioConfig = `./${path.join('.', parsedAnswers.wdioConfigPath.replace(
|
|
849
|
+
const rootDir = await getProjectRoot(parsedAnswers);
|
|
850
|
+
const pathToWdioConfig = `./${path.join('.', parsedAnswers.wdioConfigPath.replace(rootDir, ''))}`;
|
|
850
851
|
const wdioScripts = {
|
|
851
852
|
'wdio': `wdio run ${pathToWdioConfig}`,
|
|
852
853
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.20.0",
|
|
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",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"typeScriptVersion": "3.8.3",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@types/node": "^20.1.1",
|
|
49
|
-
"@wdio/config": "8.
|
|
50
|
-
"@wdio/globals": "8.
|
|
49
|
+
"@wdio/config": "8.20.0",
|
|
50
|
+
"@wdio/globals": "8.20.0",
|
|
51
51
|
"@wdio/logger": "8.16.17",
|
|
52
52
|
"@wdio/protocols": "8.18.0",
|
|
53
|
-
"@wdio/types": "8.
|
|
54
|
-
"@wdio/utils": "8.
|
|
53
|
+
"@wdio/types": "8.20.0",
|
|
54
|
+
"@wdio/utils": "8.20.0",
|
|
55
55
|
"async-exit-hook": "^2.0.1",
|
|
56
56
|
"chalk": "^5.2.0",
|
|
57
57
|
"chokidar": "^3.5.3",
|
|
@@ -66,9 +66,8 @@
|
|
|
66
66
|
"lodash.union": "^4.6.0",
|
|
67
67
|
"read-pkg-up": "10.1.0",
|
|
68
68
|
"recursive-readdir": "^2.2.3",
|
|
69
|
-
"webdriverio": "8.
|
|
70
|
-
"yargs": "^17.7.2"
|
|
71
|
-
"yarn-install": "^1.0.0"
|
|
69
|
+
"webdriverio": "8.20.0",
|
|
70
|
+
"yargs": "^17.7.2"
|
|
72
71
|
},
|
|
73
72
|
"devDependencies": {
|
|
74
73
|
"@types/async-exit-hook": "^2.0.0",
|
|
@@ -78,10 +77,11 @@
|
|
|
78
77
|
"@types/lodash.pickby": "^4.6.7",
|
|
79
78
|
"@types/lodash.union": "^4.6.7",
|
|
80
79
|
"@types/recursive-readdir": "^2.2.1",
|
|
81
|
-
"@types/yargs": "^17.0.24"
|
|
80
|
+
"@types/yargs": "^17.0.24",
|
|
81
|
+
"detect-package-manager": "^3.0.1"
|
|
82
82
|
},
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "6aa9e33233a6abc832bb16d2e24aaaa382e206b6"
|
|
87
87
|
}
|