Closed VividLemon closed 1 year ago
having the same problem. would like to run tests against https on windows as well as linux.
@codeflorist
Did I understand you correctly that you want to run Cypress tests on Windows and Linux? Are you running these locally or do you use one of the CI providers listed on https://docs.cypress.io/guides/continuous-integration/ci-provider-examples?
Regardless on if a ci provider would work -- and it is going to be the preferred method of mine when I set it up, it still isn't bulletproof. About half of hour team uses Windows, and the other half Mac. I'm not 100% certain how mac sets their environment variables, but if it doesn't use "set", then the actual script will not work for them.
It really begs the question on why start-server-and-test decides to watch for an environment variable, and not an inline flag.
@VividLemon
You might want to consider a tool such as cross-env or one of its follow-on solutions.
If you are going to be using a GitHub Actions workflow later on you can set environment variables independently of the runner operating system used. See the GitHub documentation Variables.
If you are interested in discussing how other users have solved this issue, you can use the Cypress Discord chat room.
Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue.
Is this a bug report or a feature request?
If this is a bug report, please provide as much info as possible
So I have the following script:
"test:e2e:ci": "set START_SERVER_AND_TEST_INSECURE=1 && start-server-and-test 'pnpm run preview' https://localhost:4173/ 'cypress run --e2e'",
At this point, it works fine. Note that I am on windows, and powershell prefers "set".
Following the reference module section on here https://docs.cypress.io/guides/continuous-integration/introduction#Solutions doesn't work, I assume there's some difference between the shells. (
"test": "start-server-and-test start http://localhost:3030 cy:run"
) (I've never written that syntax to set an env variable on linux, but that doesn't mean it wouldn't work, I've just never done it before, so I'm not sure if it does)I am trying to figure out a foolproof way to make sure that the "ci" script will run in all environments. It's a mystery to me why this is using the env, and not an argument. So, my issue is more of a question, as imo the docs are not very clear on getting this to work.
Any help would be appreciated, I am aware issues aren't specifically for questions.