diff --git a/packages/@vue/cli-plugin-e2e-cypress/index.js b/packages/@vue/cli-plugin-e2e-cypress/index.js index f567262a36..cef10406ee 100644 --- a/packages/@vue/cli-plugin-e2e-cypress/index.js +++ b/packages/@vue/cli-plugin-e2e-cypress/index.js @@ -8,7 +8,8 @@ module.exports = (api, options) => { '--headless': 'run in headless mode without GUI', '--mode': 'specify the mode the dev server should run in. (default: production)', '--url': 'run e2e tests against given url instead of auto-starting dev server', - '-s, --spec': '(headless only) runs a specific spec file. defaults to "all"' + '-s, --spec': '(headless only) runs a specific spec file. defaults to "all"', + '--command': 'vue-cli-service command to run (default: serve)' }, details: `All Cypress CLI options are also supported:\n` + @@ -17,12 +18,15 @@ module.exports = (api, options) => { removeArg(rawArgs, 'mode') removeArg(rawArgs, 'url') removeArg(rawArgs, 'config') + removeArg(rawArgs, 'command') info(`Starting e2e tests...`) + const command = args.command || 'serve' + const { url, server } = args.url ? { url: args.url } - : await api.service.run('serve') + : await api.service.run(command) const configs = typeof args.config === 'string' ? args.config.split(',') : [] const cyArgs = [ diff --git a/packages/@vue/cli-plugin-e2e-nightwatch/index.js b/packages/@vue/cli-plugin-e2e-nightwatch/index.js index cb1a595a79..a1e38a77ee 100644 --- a/packages/@vue/cli-plugin-e2e-nightwatch/index.js +++ b/packages/@vue/cli-plugin-e2e-nightwatch/index.js @@ -13,7 +13,8 @@ module.exports = (api, options) => { '--use-selenium': 'use Selenium standalone server instead of chromedriver or geckodriver', '-e, --env': 'specify comma-delimited browser envs to run in (default: chrome)', '-t, --test': 'specify a test to run by name', - '-f, --filter': 'glob to filter tests by filename' + '-f, --filter': 'glob to filter tests by filename', + '--command': 'vue-cli-service command to run (default: serve)' }, details: `All Nightwatch CLI options are also supported.\n` + @@ -42,7 +43,7 @@ module.exports = (api, options) => { } // remove args - ;['url', 'mode'].forEach(toRemove => removeArg(rawArgs, toRemove)) + ;['url', 'mode', 'command'].forEach(toRemove => removeArg(rawArgs, toRemove)) // remove flags ;['headless', 'use-selenium', 'parallel'].forEach(toRemove => removeArg(rawArgs, toRemove, 0)) @@ -100,13 +101,13 @@ module.exports.defaultModes = { } function startDevServer (args, api) { - const { url } = args + const { url, command } = args if (url) { return Promise.resolve({ url }) } - return api.service.run('serve') + return api.service.run(command || 'serve') } async function loadNightwatchConfig (rawArgs, api) {