Skip to content

Commit

Permalink
fix: should correctly resolve cypress bin path for Cypress 10
Browse files Browse the repository at this point in the history
Fixes #7194
  • Loading branch information
haoqunjiang committed Jun 15, 2022
1 parent b2b07a5 commit 697bb44
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/@vue/cli-plugin-e2e-cypress/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path')

module.exports = (api, options) => {
const { info, chalk, execa, resolveModule } = require('@vue/cli-shared-utils')

Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 697bb44

Please sign in to comment.