Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79d98a8
commit b7596d0
Showing
4 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 23 additions & 2 deletions
25
packages/@vue/cli-plugin-e2e-webdriverio/generator/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
module.exports = api => { | ||
const { installedBrowsers } = require('@vue/cli-shared-utils') | ||
|
||
module.exports = (api, { webdrivers }) => { | ||
api.render('./template', { | ||
hasTS: api.hasPlugin('typescript'), | ||
hasESLint: api.hasPlugin('eslint') | ||
}) | ||
|
||
const devDependencies = {} | ||
|
||
// Use devDependencies to store latest version number so as to automate update | ||
const pluginDeps = require('../package.json').devDependencies | ||
|
||
if (webdrivers && webdrivers.includes('firefox')) { | ||
devDependencies.geckodriver = pluginDeps.geckodriver | ||
} | ||
if (webdrivers && webdrivers.includes('chrome')) { | ||
// chromedriver major version bumps every 6 weeks following Chrome | ||
// so there may be a mismatch between | ||
// user's installed browser version and the default provided version | ||
// fallback to the devDependencies version in case detection fails | ||
devDependencies.chromedriver = installedBrowsers.chrome | ||
? installedBrowsers.chrome.match(/^(\d+)\./)[1] | ||
: pluginDeps.chromedriver | ||
} | ||
|
||
api.extendPackage({ | ||
scripts: { | ||
'test:e2e': 'vue-cli-service test:e2e' | ||
} | ||
}, | ||
devDependencies | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters