|
| 1 | +const path = require('path') |
| 2 | + |
1 | 3 | module.exports = (api, options) => {
|
2 | 4 | const { info, chalk, execa, resolveModule } = require('@vue/cli-shared-utils')
|
3 | 5 |
|
@@ -32,8 +34,16 @@ module.exports = (api, options) => {
|
32 | 34 | ]
|
33 | 35 |
|
34 | 36 | // Use loadModule to allow users to customize their Cypress dependency version.
|
35 | | - const cypressBinPath = resolveModule('cypress/bin/cypress', api.getCwd()) || |
36 | | - resolveModule('cypress/bin/cypress', __dirname) |
| 37 | + const cypressPackageJsonPath = |
| 38 | + resolveModule('cypress/package.json', api.getCwd()) || |
| 39 | + resolveModule('cypress/package.json', __dirname) |
| 40 | + const cypressPkg = require(cypressPackageJsonPath) |
| 41 | + const cypressBinPath = path.resolve( |
| 42 | + cypressPackageJsonPath, |
| 43 | + '../', |
| 44 | + cypressPkg.bin.cypress |
| 45 | + ) |
| 46 | + |
37 | 47 | const runner = execa(cypressBinPath, cyArgs, { stdio: 'inherit' })
|
38 | 48 | if (server) {
|
39 | 49 | runner.on('exit', () => server.close())
|
|
0 commit comments