stocky-dream-36427
11/06/2020, 3:20 AMstocky-dream-36427
11/06/2020, 3:20 AMstocky-dream-36427
11/06/2020, 3:21 AMstocky-dream-36427
11/06/2020, 3:40 AMstocky-dream-36427
11/06/2020, 3:41 AMthousands-lawyer-86765
11/06/2020, 3:45 AMthousands-lawyer-86765
11/06/2020, 3:45 AMstocky-dream-36427
11/06/2020, 4:04 AMstocky-dream-36427
11/06/2020, 4:04 AMstocky-dream-36427
11/06/2020, 4:04 AMstocky-dream-36427
11/06/2020, 4:05 AMstocky-dream-36427
11/06/2020, 4:05 AMstocky-dream-36427
11/06/2020, 4:05 AMbest-kilobyte-86726
11/13/2020, 4:00 PMOpening Cypress...
ERROR TypeError: envValue.match is not a function
TypeError: envValue.match is not a function
This is what I get. For some reason, when starting cypress (npx cypress open
) it seems to still use Vue-CLI code.best-kilobyte-86726
11/13/2020, 4:05 PMnpx vue-cli-service test:e2e --mode test
always runs Cypress v3.8... 😦stocky-dream-36427
11/13/2020, 6:56 PMstocky-dream-36427
11/13/2020, 6:57 PMstocky-dream-36427
11/13/2020, 6:57 PMstocky-dream-36427
11/13/2020, 6:57 PMstocky-dream-36427
11/13/2020, 7:02 PMstocky-dream-36427
11/13/2020, 9:26 PMstocky-dream-36427
11/13/2020, 9:27 PMnode_modules/@vue/cli-plugin-e2e-cypress/node_modules/.bin/cypress
) and then calls require.resolve
to find the binary. Installing Cypress as a devDependency will create and link node_modules/.bin/cypress
, but Vue CLI doesn't find it.
We're brewing a PR to solve this, but in the meantime if you don't want to wait I have a workaround:
@vue/cli-plugin-e2e-cypress
is basically the same thing as the [start-server-and-test](https://www.npmjs.com/package/start-server-and-test) package. The only difference is that the API is nicer and it registers itself in the Vue CLI UI. The start-server-and-test package is maintained by one of our core developers and Cypress itself uses it throughout our own internal testing ecosystem.
To achieve feature parity w/ the existing Vue CLI behavior you can switch to using start-server-and-test and referencing the cypress executable in your package.json.
1. Remove the Vue CLI e2e plugin
2. Replace it with [start-server-and-test](https://www.npmjs.com/package/start-server-and-test) and a direct Cypress devDependency, where you call npm run serve
and then your cypress test command of choice. For CI (headless mode) this is usually cypress run
, for local development this is usually cypress open
After doing this, your package.json should look something like:
{
"scripts": {
"serve": "vue-cli-service serve",
"test:e2e": "start-server-and-test 'yarn serve' :8080 'cypress open'",
"test:e2e:ci": "start-server-and-test 'yarn serve --mode=production' :8080 'cypress run'"
},
"devDependencies": {
"cypress": "^5.6.0",
"start-server-and-test": "^1.11.5"
}
}
Obviously this isn't as terse as dispatching it to vue-cli-service, but this is how we do it internally at Cypress.stocky-dream-36427
11/13/2020, 9:28 PMstocky-dream-36427
11/13/2020, 9:29 PMenvValue
in the mocha-junit-reporter
, but I did not see envValue.match
anywhere -- perhaps there is a mismatched dependencybest-kilobyte-86726
11/15/2020, 8:25 PMenv-smart
with .env.types
file, which still caused an error when starting Cypress, even though we were not trying to use the vue-cli. For example a direct cypress open
call would still use the vue-cli-service. Super weird. Maybe it was some kind of webpack loader thing? Really hard to say...
Anyway, we fixed that by removing env-smart
from Cypress plugins index and instead just used dotenv
to load the ENV variables.stocky-dream-36427
11/15/2020, 9:50 PMstocky-dream-36427
11/15/2020, 9:51 PMbreezy-australia-64868
11/17/2020, 2:15 AMstocky-dream-36427
11/17/2020, 2:15 AMstocky-dream-36427
11/17/2020, 2:16 AM