create-wdio 7.2.0 → 8.1.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/.eslintrc.cjs ADDED
@@ -0,0 +1,37 @@
1
+ module.exports = {
2
+ root: true,
3
+ parser: '@typescript-eslint/parser',
4
+ plugins: ['@typescript-eslint', 'unicorn'],
5
+ extends: [
6
+ 'eslint:recommended',
7
+ 'plugin:import/errors',
8
+ 'plugin:import/warnings'
9
+ ],
10
+ env: {
11
+ node: true,
12
+ es6: true,
13
+ jest: true
14
+ },
15
+ parserOptions: {
16
+ ecmaVersion: 2019,
17
+ sourceType: 'module'
18
+ },
19
+ rules: {
20
+ semi: ['error', 'never'],
21
+ quotes: ['error', 'single'],
22
+ indent: [2, 4],
23
+
24
+ 'no-constant-condition': 0,
25
+ // see https://stackoverflow.com/questions/55280555/typescript-eslint-eslint-plugin-error-route-is-defined-but-never-used-no-un
26
+ 'no-unused-vars': 'off',
27
+ '@typescript-eslint/no-unused-vars': 'error',
28
+
29
+ 'import/no-unresolved': 0,
30
+ 'import/named': 2,
31
+ 'import/namespace': 2,
32
+ 'import/default': 2,
33
+ 'import/export': 2,
34
+
35
+ 'unicorn/prefer-node-protocol': ['error']
36
+ }
37
+ }
package/LICENSE CHANGED
@@ -1,21 +1,20 @@
1
- MIT License
1
+ Copyright (c) OpenJS Foundation and other contributors
2
2
 
3
- Copyright (c) 2021 Christian Bromann
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
4
10
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
11
13
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -23,7 +23,7 @@ To install a WebdriverIO project, you may choose one of the following methods:
23
23
  #### npx
24
24
 
25
25
  ```sh
26
- npx create-wdio ./e2e
26
+ npx create-wdio@latest ./e2e
27
27
  ```
28
28
 
29
29
  _[`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) is a package runner tool that comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f)_
@@ -31,7 +31,7 @@ _[`npx`](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f
31
31
  #### npm
32
32
 
33
33
  ```sh
34
- npm init wdio ./e2e
34
+ npm init wdio@latest ./e2e
35
35
  ```
36
36
 
37
37
  _[`npm init <initializer>`](https://docs.npmjs.com/cli/v7/commands/npm-init) is available in npm 6+_
@@ -39,16 +39,16 @@ _[`npm init <initializer>`](https://docs.npmjs.com/cli/v7/commands/npm-init) is
39
39
  #### yarn
40
40
 
41
41
  ```sh
42
- yarn create wdio ./e2e
42
+ yarn create wdio@latest ./e2e
43
43
  ```
44
44
 
45
45
  _[`yarn create <starter-kit-package>`](https://yarnpkg.com/lang/en/docs/cli/create/) is available in Yarn 0.25+_
46
46
 
47
47
 
48
- It will create a directory called `e2e` inside the current folder.
49
- Then it will run the configuration wizard that will help you setup your framework.
48
+ It will create a directory called `e2e` inside the current folder.
49
+ Then it will run the configuration wizard that will help you set-up your framework.
50
+
50
51
 
51
-
52
52
  ## Supported Options
53
53
 
54
54
  You can pass the following command line flags to modify the bootstrap mechanism:
@@ -56,6 +56,7 @@ You can pass the following command line flags to modify the bootstrap mechanism:
56
56
  * `--dev` - Install all packages as `devDependencies` (default: `true`)
57
57
  * `--yes` - Will fill in all config defaults without prompting (default: `false`)
58
58
  * `--use-yarn` - yes, we support yarn too! (default: `true`)
59
+ * `--npm-tag` - use a specific NPM tag for `@wdio/cli` package (default: `latest`)
59
60
  * `--verbose` - print additional logs (default: `false`)
60
61
 
61
62
  ----
@@ -0,0 +1,18 @@
1
+ import { vi } from 'vitest'
2
+
3
+ const command: any = {}
4
+ command.name = vi.fn().mockReturnValue(command)
5
+ command.version = vi.fn().mockReturnValue(command)
6
+ command.usage = vi.fn().mockReturnValue(command)
7
+ command.arguments = vi.fn().mockReturnValue(command)
8
+ command.action = vi.fn((cb) => {
9
+ cb('someProjectName')
10
+ return command
11
+ })
12
+ command.option = vi.fn().mockReturnValue(command)
13
+ command.allowUnknownOption = vi.fn().mockReturnValue(command)
14
+ command.on = vi.fn().mockReturnValue(command)
15
+ command.parse = vi.fn().mockReturnValue(command)
16
+ command.opts = vi.fn().mockReturnValue('foobar')
17
+
18
+ export const Command = vi.fn().mockReturnValue(command)
package/bin/wdio.js CHANGED
@@ -4,4 +4,6 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- require('../build').run()
7
+ import { run } from '../build/index.js'
8
+
9
+ run()
@@ -1,14 +1,6 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UNSUPPORTED_NODE_VERSION = exports.PROGRAM_TITLE = exports.ASCII_ROBOT = exports.DEFAULT_NPM_TAG = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- exports.DEFAULT_NPM_TAG = 'latest';
9
- const colorItBold = chalk_1.default.bold.rgb(234, 89, 6);
10
- const colorIt = chalk_1.default.rgb(234, 89, 6);
11
- exports.ASCII_ROBOT = `
1
+ import { colorItBold, colorIt } from './utils.js';
2
+ export const DEFAULT_NPM_TAG = 'latest';
3
+ export const ASCII_ROBOT = `
12
4
  -:...........................-:.
13
5
  + +
14
6
  \`\` + \`...\` \`...\` + \`
@@ -49,10 +41,11 @@ oooooooo+\`-oooo\`-- \`/\` .:+ -/-\`/\` .:::::::::: .oooo-.+oooooooo
49
41
  -/::::::::://:/+ \`+/:+::::::::::+.
50
42
  :oooooooooooo++/ +++oooooooooooo-
51
43
  `;
52
- exports.PROGRAM_TITLE = `
44
+ export const PROGRAM_TITLE = `
53
45
  ${colorItBold('Webdriver.IO')}
54
46
  ${colorIt('Next-gen browser and mobile automation')}
55
47
  ${colorIt('test framework for Node.js')}
56
48
  `;
57
- exports.UNSUPPORTED_NODE_VERSION = (`You are using Node ${process.version} so the project will be bootstrapped with an old unsupported version of tools.\n\n` +
58
- 'Please update to Node 12 or higher for a better, fully supported experience.\n');
49
+ export const UNSUPPORTED_NODE_VERSION = ('⚠️ Unsupported Node.js Version Error ⚠️\n' +
50
+ `You are using Node.js ${process.version} which is to old to be used with WebdriverIO.\n` +
51
+ 'Please update to Node.js v16 to continue.\n');
package/build/index.js CHANGED
@@ -1,38 +1,34 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.run = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const commander_1 = require("commander");
11
- const semver_1 = __importDefault(require("semver"));
12
- const utils_1 = require("./utils");
13
- const constants_1 = require("./constants");
14
- let pkg = { version: 'unknown' };
15
- try {
16
- pkg = JSON.parse(fs_1.default.readFileSync(__dirname + '/../package.json').toString());
17
- }
18
- catch (e) {
19
- /* ignore */
20
- }
21
- let projectName;
22
- let useYarn;
23
- function run(operation = createWebdriverIO) {
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import chalk from 'chalk';
4
+ import semver from 'semver';
5
+ import { Command } from 'commander';
6
+ import { runProgram, shouldUseYarn, getPackageVersion } from './utils.js';
7
+ import { ASCII_ROBOT, PROGRAM_TITLE, UNSUPPORTED_NODE_VERSION, DEFAULT_NPM_TAG } from './constants.js';
8
+ const WDIO_COMMAND = 'wdio';
9
+ let projectDir;
10
+ export async function run(operation = createWebdriverIO) {
11
+ const version = await getPackageVersion();
24
12
  /**
25
13
  * print program ASCII art
26
14
  */
27
15
  if (!(process.argv.includes('--version') || process.argv.includes('-v'))) {
28
- console.log(constants_1.ASCII_ROBOT, constants_1.PROGRAM_TITLE);
16
+ console.log(ASCII_ROBOT, PROGRAM_TITLE);
17
+ }
18
+ /**
19
+ * ensure right Node.js version is used
20
+ */
21
+ const unsupportedNodeVersion = !semver.satisfies(process.version, '>=16');
22
+ if (unsupportedNodeVersion) {
23
+ console.log(chalk.yellow(UNSUPPORTED_NODE_VERSION));
24
+ return;
29
25
  }
30
- const program = new commander_1.Command('wdio')
31
- .version(`v${pkg.version}`, '-v, --version')
32
- .arguments('[project]')
33
- .usage(`${chalk_1.default.green('[project]')} [options]`)
34
- .action(name => (projectName = name))
35
- .option('-t, --npm-tag <tag>', 'Which NPM version you like to install, e.g. @next', constants_1.DEFAULT_NPM_TAG)
26
+ const program = new Command(WDIO_COMMAND)
27
+ .version(version, '-v, --version')
28
+ .arguments('[project-path]')
29
+ .usage(`${chalk.green('[project-path]')} [options]`)
30
+ .action(name => (projectDir = name))
31
+ .option('-t, --npm-tag <tag>', 'Which NPM version you like to install, e.g. @next', DEFAULT_NPM_TAG)
36
32
  .option('-u, --use-yarn', 'Use Yarn package manager to install packages', false)
37
33
  .option('-v, --verbose', 'print additional logs')
38
34
  .option('-y, --yes', 'will fill in all config defaults without prompting', false)
@@ -40,88 +36,30 @@ function run(operation = createWebdriverIO) {
40
36
  .allowUnknownOption()
41
37
  .on('--help', () => console.log())
42
38
  .parse(process.argv);
43
- if (typeof projectName === 'undefined' && !fs_1.default.existsSync('package.json')) {
44
- console.error('There is no package.json in current directory!\n');
45
- console.log('To create WebdriverIO in a new project pass in a directory name:\n' +
46
- ` npm init ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green('/path/to/project/directory')}\n` +
47
- '\n' +
48
- 'For example:\n' +
49
- ` npm init ${chalk_1.default.cyan(program.name())} ${chalk_1.default.green('./tests')}\n` +
50
- '\n' +
51
- 'To update current project to include WebdriverIO packages, run this script in a directory with package.json\n' +
52
- `Run ${chalk_1.default.cyan(`${program.name()} --help`)} to see all options.`);
53
- process.exit(1);
54
- }
55
- return operation(program.opts()).then(() => console.log(`To start the test, run: ${chalk_1.default.cyan('$ npm run')} ${chalk_1.default.green(program.name())}`));
39
+ return operation(program.opts());
56
40
  }
57
- exports.run = run;
58
- async function createWebdriverIO(opts) {
59
- const cwd = process.cwd();
41
+ export async function createWebdriverIO(opts) {
42
+ const useYarn = typeof opts.useYarn === 'boolean'
43
+ ? opts.useYarn
44
+ : await shouldUseYarn();
60
45
  const npmTag = opts.npmTag.startsWith('@') ? opts.npmTag : `@${opts.npmTag}`;
61
- const unsupportedNodeVersion = !semver_1.default.satisfies(process.version, '>=12');
62
- if (unsupportedNodeVersion) {
63
- console.log(chalk_1.default.yellow(constants_1.UNSUPPORTED_NODE_VERSION));
46
+ const root = path.resolve(process.cwd(), projectDir || '');
47
+ const rootDirExists = await fs.access(root).then(() => true, () => false);
48
+ if (!rootDirExists) {
49
+ await fs.mkdir(root, { recursive: true });
64
50
  }
65
- useYarn = opts.useYarn && await (0, utils_1.shouldUseYarn)();
66
- let root = path_1.default.join(process.cwd(), projectName || '');
67
- if (!await (0, utils_1.exists)(root)) {
68
- await fs_1.default.promises.mkdir(root, { recursive: true });
69
- }
70
- process.chdir(root);
71
- root = process.cwd();
72
- const currentDir = process.cwd();
73
- const pkgJsonPath = path_1.default.join(currentDir, 'package.json');
74
- if (!useYarn && !(0, utils_1.checkThatNpmCanReadCwd)()) {
75
- process.exit(1);
76
- }
77
- console.log(`\nCreating WebdriverIO project in ${chalk_1.default.bold(root)}\n`);
78
- if (!await (0, utils_1.exists)(pkgJsonPath)) {
79
- console.log('package.json file does not exist in current dir, creating it...');
80
- const pkgJson = {
81
- name: 'webdriverio-tests',
82
- version: '0.1.0',
83
- private: true
84
- };
85
- await fs_1.default.promises.writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 4));
86
- }
87
- const deps = [`@wdio/cli${npmTag}`];
88
- await install(deps.flat(), root, opts);
89
- console.log('\nFinished installing packages.');
90
- console.log('\nRunning WDIO CLI Wizard...');
91
- await (0, utils_1.runProgram)('npx', ['wdio', 'config', ...(useYarn ? ['--yarn'] : []), ...(opts.yes ? ['--yes'] : [])]);
92
- if (await (0, utils_1.exists)(pkgJsonPath)) {
93
- console.log('Adding scripts to package.json');
94
- const pkgJson = require(pkgJsonPath);
95
- const isUsingTypescript = await (0, utils_1.exists)('test/wdio.conf.ts');
96
- if (!pkgJson.scripts) {
97
- pkgJson.scripts = {};
98
- }
99
- pkgJson.scripts['wdio'] = `wdio run ${isUsingTypescript ? 'test/wdio.conf.ts' : 'wdio.conf.js'}`;
100
- await fs_1.default.promises.writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 4));
101
- }
102
- console.log(`\n🤖 Successfully setup project at ${root} 🎉`);
103
- if (root != cwd) {
104
- console.log(`\n${chalk_1.default.yellow('⚠')} First, change the directory via: ${chalk_1.default.cyan('$ cd')} ${chalk_1.default.green(root)}`);
105
- }
106
- }
107
- function install(dependencies, root, opts) {
51
+ console.log(`\nInstalling ${chalk.bold('@wdio/cli')} to initialize project...`);
108
52
  const logLevel = opts.verbose ? 'trace' : 'error';
109
- let command;
110
- let args;
111
- console.log('Installing packages: ', chalk_1.default.green(dependencies.join(', ')), '\n');
112
- if (useYarn) {
113
- command = 'yarnpkg';
114
- args = ['add', ...(opts.dev ? ['-D'] : []), '--exact', ...dependencies];
115
- // Explicitly set cwd() to work around issues like
116
- // https://github.com/facebook/create-react-app/issues/3326.
117
- // Unfortunately we can only do this for Yarn because npm support for
118
- // equivalent --prefix flag doesn't help with this issue.
119
- // This is why for npm, we run checkThatNpmCanReadCwd() early instead.
120
- args.push('--cwd', root);
121
- }
122
- else {
123
- command = 'npm';
124
- args = ['install', opts.dev ? '--save-dev' : '--save', '--loglevel', logLevel, ...dependencies];
125
- }
126
- return (0, utils_1.runProgram)(command, args);
53
+ const command = useYarn ? 'yarnpkg' : 'npm';
54
+ const args = useYarn
55
+ ? ['add', ...(opts.dev ? ['-D'] : []), '--exact', '--cwd', root, `@wdio/cli${npmTag}`]
56
+ : ['install', opts.dev ? '--save-dev' : '--save', '--loglevel', logLevel, `@wdio/cli${npmTag}`];
57
+ await runProgram(command, args, { cwd: root, stdio: 'ignore' });
58
+ console.log(chalk.green.bold('✔ Success!'));
59
+ return runProgram('npx', [
60
+ WDIO_COMMAND,
61
+ 'config',
62
+ ...(useYarn ? ['--yarn'] : []),
63
+ ...(opts.yes ? ['--yes'] : [])
64
+ ], { cwd: root });
127
65
  }
package/build/types.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
package/build/utils.js CHANGED
@@ -1,18 +1,13 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkThatNpmCanReadCwd = exports.shouldUseYarn = exports.runProgram = exports.exists = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const cross_spawn_1 = __importDefault(require("cross-spawn"));
10
- function exists(path) {
11
- return fs_1.default.promises.access(path).then(() => true, () => false);
12
- }
13
- exports.exists = exists;
14
- function runProgram(command, args, options = { stdio: 'inherit' }) {
15
- const child = (0, cross_spawn_1.default)(command, args, options);
1
+ import url from 'node:url';
2
+ import path from 'node:path';
3
+ import fs from 'node:fs/promises';
4
+ import spawn from 'cross-spawn';
5
+ import chalk from 'chalk';
6
+ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
7
+ export const colorItBold = chalk.bold.rgb(234, 89, 6);
8
+ export const colorIt = chalk.rgb(234, 89, 6);
9
+ export function runProgram(command, args, options) {
10
+ const child = spawn(command, args, { stdio: 'inherit', ...options });
16
11
  return new Promise((resolve, reject) => {
17
12
  let error;
18
13
  child.on('error', (e) => (error = e));
@@ -25,56 +20,19 @@ function runProgram(command, args, options = { stdio: 'inherit' }) {
25
20
  });
26
21
  });
27
22
  }
28
- exports.runProgram = runProgram;
29
- function shouldUseYarn() {
23
+ /* c8 ignore start */
24
+ export function shouldUseYarn() {
30
25
  return runProgram('yarnpkg', ['--version'], { stdio: 'ignore' }).then(() => true, () => false);
31
26
  }
32
- exports.shouldUseYarn = shouldUseYarn;
33
- function checkThatNpmCanReadCwd() {
34
- const cwd = process.cwd();
35
- let childOutput = null;
27
+ /* c8 ignore end */
28
+ export async function getPackageVersion() {
36
29
  try {
37
- // Note: intentionally using spawn over exec since
38
- // the problem doesn't reproduce otherwise.
39
- // `npm config list` is the only reliable way I could find
40
- // to reproduce the wrong path. Just printing process.cwd()
41
- // in a Node process was not enough.
42
- childOutput = cross_spawn_1.default.sync('npm', ['config', 'list']).output.join('');
43
- }
44
- catch (err) {
45
- // Something went wrong spawning node.
46
- // Not great, but it means we can't do this check.
47
- // We might fail later on, but let's continue.
48
- return true;
49
- }
50
- if (typeof childOutput !== 'string') {
51
- return true;
52
- }
53
- const lines = childOutput.split('\n');
54
- // `npm config list` output includes the following line:
55
- // "; cwd = C:\path\to\current\dir" (unquoted)
56
- // I couldn't find an easier way to get it.
57
- const prefix = '; cwd = ';
58
- const line = lines.find(line => line.indexOf(prefix) === 0);
59
- if (typeof line !== 'string') {
60
- // Fail gracefully. They could remove it.
61
- return true;
62
- }
63
- const npmCWD = line.substring(prefix.length);
64
- if (npmCWD === cwd) {
65
- return true;
30
+ const pkgJsonPath = path.join(__dirname, '..', 'package.json');
31
+ const pkg = JSON.parse((await fs.readFile(pkgJsonPath)).toString());
32
+ return `v${pkg.version}`;
66
33
  }
67
- console.error(chalk_1.default.red('Could not start an npm process in the right directory.\n\n' +
68
- `The current directory is: ${chalk_1.default.bold(cwd)}\n` +
69
- `However, a newly started npm process runs in: ${chalk_1.default.bold(npmCWD)}\n\n` +
70
- 'This is probably caused by a misconfigured system terminal shell.'));
71
- if (process.platform === 'win32') {
72
- console.error(chalk_1.default.red('On Windows, this can usually be fixed by running:\n\n') +
73
- ` ${chalk_1.default.cyan('reg')} delete "HKCU\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n` +
74
- ` ${chalk_1.default.cyan('reg')} delete "HKLM\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n\n` +
75
- chalk_1.default.red('Try to run the above two lines in the terminal.\n') +
76
- chalk_1.default.red('To learn more about this problem, read: https://blogs.msdn.microsoft.com/oldnewthing/20071121-00/?p=24433/'));
34
+ catch (e) {
35
+ /* ignore */
77
36
  }
78
- return false;
37
+ return 'unknown';
79
38
  }
80
- exports.checkThatNpmCanReadCwd = checkThatNpmCanReadCwd;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "create-wdio",
3
- "version": "7.2.0",
4
- "description": "Install WebdriverIO with all its dependencies in a single run",
5
- "author": "Christian Bromann <christian@saucelabs.com>",
3
+ "version": "8.1.0",
4
+ "description": "Install and setup a WebdriverIO project with all its dependencies in a single run",
5
+ "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/webdriverio/create-wdio#readme",
8
8
  "repository": {
@@ -22,6 +22,7 @@
22
22
  "bin": {
23
23
  "create-wdio": "./bin/wdio.js"
24
24
  },
25
+ "type": "module",
25
26
  "scripts": {
26
27
  "build": "run-s clean compile",
27
28
  "clean": "rimraf tsconfig.tsbuildinfo ./build ./coverage",
@@ -32,31 +33,30 @@
32
33
  "release:minor": "npm run release -- minor",
33
34
  "release:major": "npm run release -- major",
34
35
  "test": "run-s build test:*",
35
- "test:eslint": "eslint -c ./.eslintrc.js ./src/**/*.ts ./tests/**/*.ts",
36
- "test:unit": "npx jest",
36
+ "test:eslint": "eslint -c ./.eslintrc.cjs ./src/**/*.ts ./tests/**/*.ts",
37
+ "test:unit": "vitest",
37
38
  "watch": "npm run compile -- --watch"
38
39
  },
39
40
  "devDependencies": {
40
- "@schemastore/package": "^0.0.6",
41
41
  "@types/cross-spawn": "^6.0.2",
42
- "@types/jest": "^27.4.1",
43
- "@types/node": "^18.0.0",
44
- "@types/semver": "^7.3.9",
45
- "@typescript-eslint/eslint-plugin": "^5.14.0",
46
- "@typescript-eslint/parser": "^5.14.0",
47
- "eslint": "^8.10.0",
48
- "eslint-plugin-import": "^2.25.4",
49
- "jest": "^27.5.1",
42
+ "@types/node": "^18.7.23",
43
+ "@types/semver": "^7.3.12",
44
+ "@typescript-eslint/eslint-plugin": "^5.38.1",
45
+ "@typescript-eslint/parser": "^5.38.1",
46
+ "@vitest/coverage-c8": "^0.25.0",
47
+ "c8": "^7.12.0",
48
+ "eslint": "^8.24.0",
49
+ "eslint-plugin-import": "^2.26.0",
50
+ "eslint-plugin-unicorn": "^45.0.0",
50
51
  "npm-run-all": "^4.1.5",
51
- "release-it": "^15.0.0",
52
- "ts-jest": "^27.1.3",
53
- "ts-node": "^10.7.0",
54
- "typescript": "^4.6.2"
52
+ "release-it": "^15.4.2",
53
+ "typescript": "^4.8.4",
54
+ "vitest": "^0.25.0"
55
55
  },
56
56
  "dependencies": {
57
- "chalk": "^4.1.2",
58
- "commander": "^9.0.0",
57
+ "chalk": "^5.0.1",
58
+ "commander": "^9.4.0",
59
59
  "cross-spawn": "^7.0.3",
60
- "semver": "^7.3.5"
60
+ "semver": "^7.3.7"
61
61
  }
62
62
  }
@@ -0,0 +1,23 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite'
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ include: ['tests/**/*.test.ts'],
7
+ /**
8
+ * not to ESM ported packages
9
+ */
10
+ exclude: [
11
+ 'build', '.idea', '.git', '.cache',
12
+ '**/node_modules/**', '__mocks__'
13
+ ],
14
+ coverage: {
15
+ enabled: true,
16
+ exclude: ['**/build/**', '__mocks__', '**/*.test.ts'],
17
+ lines: 100,
18
+ functions: 82,
19
+ branches: 84,
20
+ statements: 100
21
+ }
22
+ }
23
+ })