From 697bb44ef0e78d870ed582adc71464dd2336a68a Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 15 Jun 2022 20:26:23 +0800 Subject: [PATCH] fix: should correctly resolve cypress bin path for Cypress 10 Fixes #7194 --- packages/@vue/cli-plugin-e2e-cypress/index.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/@vue/cli-plugin-e2e-cypress/index.js b/packages/@vue/cli-plugin-e2e-cypress/index.js index 6b81b68de9..4594c891ec 100644 --- a/packages/@vue/cli-plugin-e2e-cypress/index.js +++ b/packages/@vue/cli-plugin-e2e-cypress/index.js @@ -1,3 +1,5 @@ +const path = require('path') + module.exports = (api, options) => { const { info, chalk, execa, resolveModule } = require('@vue/cli-shared-utils') @@ -32,8 +34,16 @@ module.exports = (api, options) => { ] // Use loadModule to allow users to customize their Cypress dependency version. - const cypressBinPath = resolveModule('cypress/bin/cypress', api.getCwd()) || - resolveModule('cypress/bin/cypress', __dirname) + const cypressPackageJsonPath = + resolveModule('cypress/package.json', api.getCwd()) || + resolveModule('cypress/package.json', __dirname) + const cypressPkg = require(cypressPackageJsonPath) + const cypressBinPath = path.resolve( + cypressPackageJsonPath, + '../', + cypressPkg.bin.cypress + ) + const runner = execa(cypressBinPath, cyArgs, { stdio: 'inherit' }) if (server) { runner.on('exit', () => server.close())