fix: fix webdriverio ts setup

This commit is contained in:
Haoqun Jiang
2020-08-06 17:41:38 +08:00
parent 56bb3e03ae
commit 9535c1786d
3 changed files with 12 additions and 3 deletions

View File

@@ -1,6 +1,10 @@
module.exports = (api, { tsLint = false, convertJsToTs = true } = {}) => {
const jsRE = /\.js$/
const excludeRE = /^tests\/e2e\/|(\.config|rc)\.js$/
let excludeRE = /^tests\/e2e\/|(\.config|rc)\.js$/
if (api.hasPlugin('e2e-webdriverio')) {
excludeRE = /(\.config|rc)\.js$/
}
const convertLintFlags = require('../lib/convertLintFlags')
api.postProcessFiles(files => {
if (convertJsToTs) {

View File

@@ -93,7 +93,8 @@ module.exports = (api, {
api.render('./template', {
skipLibCheck,
hasMocha: api.hasPlugin('unit-mocha'),
hasJest: api.hasPlugin('unit-jest')
hasJest: api.hasPlugin('unit-jest'),
hasWebDriverIO: api.hasPlugin('e2e-webdriverio')
})
if (isVue3) {

View File

@@ -20,7 +20,11 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"<% if (hasMocha || hasJest) { %>,<% } %>
"webpack-env"<% if (hasMocha || hasJest || hasWebDriverIO) { %>,<% } %>
<%_ if (hasWebDriverIO) { _%>
"@wdio/mocha-framework",
"@wdio/sync"<% if (hasMocha || hasJest) { %>,<% } %>
<%_ } _%>
<%_ if (hasMocha) { _%>
"mocha",
"chai"