`nx e2e` with Cypress triggers `Unknown option: '--env'`
See original GitHub issueCurrent Behavior
The --env
flag is not recognized by the nx e2e
command.
Expected Behavior
I would like to be able to use an --env
flag to specify custom variables for Cypress on the command line, as we can do with the cypress run
command.
Steps to Reproduce
- Create an app with Cypress e2e capability named ‘my-app’.
- Add the environment variable declaration in
apps/my-app-e2e/cypress.json
:
{
"env": {
"myEnvKey": "myEnvDefaultValue"
},
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"modifyObstructiveCode": false,
"pluginsFile": "./src/plugins/index",
"supportFile": "./src/support/index.ts",
"video": true,
"videosFolder": "../../dist/cypress/apps/my-app-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/my-app-e2e/screenshots",
"chromeWebSecurity": false
}
$> yarn run nx e2e --project=my-app-e2e --env.myEnvKey myEnvValue
yarn run v1.21.1
$ nx e2e --project=my-app-e2e --env.myEnvKey foo
> ng run my-app-e2e:e2e --env=[object Object]
Unknown option: '--env'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Failure Logs
Unknown option: '--env'
Environment
$> yarn run nx report
yarn run v1.21.1
$ nx report
> NX Report complete - copy this into the issue template
nx : Not Found
@nrwl/angular : 10.0.13
@nrwl/cli : 10.0.10
@nrwl/cypress : 10.0.10
@nrwl/eslint-plugin-nx : 10.0.10
@nrwl/express : Not Found
@nrwl/jest : 10.0.10
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.0.10
@nrwl/web : Not Found
@nrwl/workspace : 10.0.10
typescript : 3.9.7
Done in 2.35s.
Other information
- There was an issue about it in the past: #1970
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
@nrwl/cypress:cypress | Nx
Run Cypress for e2e, integration and component testing. Options can be configured in project.json when defining the executor, or when invoking it. Read...
Read more >cypress-io/cypress - Gitter
I am using this command ng e2e --env environment=Dev --watch --headless it's giving me 'Unknown option: '--env' My cypress.json File
Read more >Testing a Virtual List component with Cypress and Storybook
Using Cypress to test components: pro: it automates a real browser, the components are tested in the same environment they will be used;...
Read more >How to run Cypress tests with GitHub Actions - Stack Overflow
I want to GitHub Actions to automatically run the cypress tests but ... to Slack channel - name: Send GitHub Action trigger data...
Read more >Configuring Vitest
Pass --config option to CLI, e.g. vitest --config ./path/to/vitest.config.ts; Use process.env.VITEST or mode property on defineConfig (will be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@hadrien-toma @mehrad-rafigh I think this is related to the way we parse the extra arguments. I have a PR open already to fix the arrays, but I will change it to a more generic approach so we can avoid such issues in the future. Stay tuned 😄
Experienced the same issue. I will open a PR later today!