mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-21 23:00:00 -06:00
fix: fix webdriver.io setup with TS
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^24.9.0",
|
||||
"chromedriver": "^81.0.0",
|
||||
"chromedriver": "^84.0.1",
|
||||
"debug": "^4.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
|
||||
@@ -11,6 +11,10 @@ module.exports = (api, { webdrivers }) => {
|
||||
// Use devDependencies to store latest version number so as to automate update
|
||||
const pluginDeps = require('../package.json').devDependencies
|
||||
|
||||
if (api.hasPlugin('typescript')) {
|
||||
devDependencies['ts-node'] = pluginDeps['ts-node']
|
||||
}
|
||||
|
||||
if (webdrivers && webdrivers.includes('firefox')) {
|
||||
devDependencies.geckodriver = pluginDeps.geckodriver
|
||||
devDependencies['wdio-geckodriver-service'] = pluginDeps['wdio-geckodriver-service']
|
||||
|
||||
@@ -11,6 +11,9 @@ exports.config = {
|
||||
// directory is where your package.json resides, so `wdio` will be called from there.
|
||||
//
|
||||
specs: [
|
||||
<%_ if (hasTS) { _%>
|
||||
path.join(__dirname, '/tests/e2e/**/*.spec.ts'),
|
||||
<%_ } _%>
|
||||
path.join(__dirname, '/tests/e2e/**/*.spec.js')
|
||||
],
|
||||
// Patterns to exclude.
|
||||
@@ -61,7 +64,9 @@ exports.config = {
|
||||
mochaOpts: {
|
||||
ui: 'bdd',
|
||||
timeout: 30000,
|
||||
<%- hasTS ? 'require: \'ts-node/register\'' : '' %>
|
||||
<%_ if (hasTS) { _%>
|
||||
require: 'ts-node/register',
|
||||
<%_ } _%>
|
||||
},
|
||||
//
|
||||
// =====
|
||||
|
||||
@@ -9,6 +9,7 @@ const CLI_OPTIONS = Object.entries(cmdArgs).reduce((obj, [param, { desc }]) => {
|
||||
return obj
|
||||
}, {})
|
||||
|
||||
/** @type {import('@vue/cli-service').ServicePlugin} */
|
||||
module.exports = (api, options) => {
|
||||
api.registerCommand('test:e2e', {
|
||||
description: 'run end-to-end tests with WebdriverIO',
|
||||
@@ -33,12 +34,17 @@ module.exports = (api, options) => {
|
||||
rawArgs.push(`--baseUrl=${url}`)
|
||||
}
|
||||
|
||||
const isTS = fs.existsSync(path.join(process.cwd(), 'tsconfig.json'))
|
||||
const isTS = fs.existsSync(path.join(api.getCwd(), 'tsconfig.json'))
|
||||
const configFile = !args.remote
|
||||
? path.join(process.cwd(), 'wdio.local.conf.' + (isTS ? 'ts' : 'js'))
|
||||
: path.join(process.cwd(), 'wdio.sauce.conf.' + (isTS ? 'ts' : 'js'))
|
||||
? path.join(api.getCwd(), 'wdio.local.conf.' + (isTS ? 'ts' : 'js'))
|
||||
: path.join(api.getCwd(), 'wdio.sauce.conf.' + (isTS ? 'ts' : 'js'))
|
||||
const wdioBinPath = require.resolve('@wdio/cli/bin/wdio')
|
||||
|
||||
if (isTS) {
|
||||
// make sure ts-node runs with commonjs format, as it does not support esm
|
||||
process.env.TS_NODE_COMPILER_OPTIONS = '{ "module": "commonjs" }'
|
||||
}
|
||||
|
||||
const runArgs = ['run', configFile, ...rawArgs]
|
||||
info(`Start WebdriverIO: $ wdio ${runArgs.join(' ')}`)
|
||||
const runner = execa(wdioBinPath, runArgs, { stdio: 'inherit' })
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"devDependencies": {
|
||||
"chromedriver": "^84.0.1",
|
||||
"geckodriver": "^1.20.0",
|
||||
"ts-node": "^8.10.2",
|
||||
"wdio-chromedriver-service": "^6.0.3",
|
||||
"wdio-geckodriver-service": "^1.1.0"
|
||||
}
|
||||
|
||||
14
yarn.lock
14
yarn.lock
@@ -6160,18 +6160,6 @@ chrome-trace-event@^1.0.2:
|
||||
dependencies:
|
||||
tslib "^1.9.0"
|
||||
|
||||
chromedriver@^81.0.0:
|
||||
version "81.0.0"
|
||||
resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-81.0.0.tgz#690ba333aedf2b4c4933b6590c3242d3e5f28f3c"
|
||||
integrity sha512-BA++IQ7O1FzHmNpzMlOfLiSBvPZ946uuhtJjZHEIr/Gb+Ha9jiuGbHiT45l6O3XGbQ8BAwvbmdisjl4rTxro4A==
|
||||
dependencies:
|
||||
"@testim/chrome-version" "^1.0.7"
|
||||
axios "^0.19.2"
|
||||
del "^5.1.0"
|
||||
extract-zip "^2.0.0"
|
||||
mkdirp "^1.0.4"
|
||||
tcp-port-used "^1.0.1"
|
||||
|
||||
chromedriver@^84.0.1:
|
||||
version "84.0.1"
|
||||
resolved "https://registry.yarnpkg.com/chromedriver/-/chromedriver-84.0.1.tgz#eaca7723f1a58c262a5c521b8596769af40b0d4f"
|
||||
@@ -19119,7 +19107,7 @@ ts-loader@^6.2.2:
|
||||
micromatch "^4.0.0"
|
||||
semver "^6.0.0"
|
||||
|
||||
ts-node@^8, ts-node@^8.4.1:
|
||||
ts-node@^8, ts-node@^8.10.2, ts-node@^8.4.1:
|
||||
version "8.10.2"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d"
|
||||
integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==
|
||||
|
||||
Reference in New Issue
Block a user