Skip to content

E2E tests with Cypress do not use .env.test for env variables #1290

Closed
@lcmen

Description

@lcmen

Version

3.0.0-beta.9

Reproduction link

https://github.com/lowski/fakturownia/tree/managing-clients - it's an app that I use for testing different techniques for Vue.js app but setup is the default one, created by Vue-cli.

Steps to reproduce

  1. Create .env.test file with some env variable, i.e:
VUE_APP_API_URL=http://localhost:8081
  1. Try to reference that variable inside any of your client-side JavaScript files, i.e.:
console.log(process.env.VUE_APP_API_URL)

What is expected?

It is expected to print http://localhost:8081 when tests are run with Cypress

What is actually happening?

It's printing undefined


I tried to pass --mode test to e2e command like this:

vue-cli-service test:e2e --mode test

But it throws error that HMR is disabled and test does not run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions