morficus / cypress-dotenv

Cypress plugin that enables compatability with dotenv
53 stars 13 forks source link

Adding a possibility to return all env variables without prefix #5

Closed e-ndrus closed 4 years ago

e-ndrus commented 4 years ago

Hello @morficus. Thanks for this great project. Submitting a PR for the plugin to see all env variables, not just those prefixed with CYPRESS_. Also adding a test for that functionality.

dandv commented 4 years ago

Does this need some extra work?

  1. In the README, the example talks only about the CYPRESS_ variable: You can use Cypress.env('HELLO) [sic] to access its value.
  2. The test .env* files don't contain unprefixed variables.
morficus commented 4 years ago

@dandv check out [this unit test] (https://github.com/morficus/cypress-dotenv/blob/a486a1857f6e324f8e7e2d5e7fa050291d0ad985/index.spec.js#L106). This is how I confirmed the optional 3rd argument was working as expected.