question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document that Cypress.env() parses booleans

See original GitHub issue

Given CYPRESS_IS_TRAVIS=true cypress open, when I run Cypress.env() in the developer tools it returns:

{
  IS_TRAVIS: true
}

I would expect it to instead return this based on the docs:

{
   IS_TRAVIS: 'true'
}

Because the documentation does not mention that string values like “true” are parsed into boolean values.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jennifer-shehanecommented, Oct 26, 2018

Hey @darellkoh, sounds great!

1reaction
jennifer-shehanecommented, Oct 29, 2018

I would likely put this in the Examples section showing an example of the usage above and saying something like:

We automatically normalize both the key and the value. Cypress will automatically convert values into Number or Boolean.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Variables | Cypress Documentation
Difference between OS-level and Cypress environment variables In Cypress, "environment variables" are variables that are accessible via Cypress.env.
Read more >
How To Inject Environment Variables Into Cypress Tests
Cypress automatically reads all environment variables that start with CYPRESS_ prefix and makes them available in Cypress.env() object.
Read more >
TypeScript All the Things in Your Cypress Tests #frontend ...
Learn how we use TypeScript in our Cypress tests at Twilio SendGrid and the tips and tricks we've learned along the way.
Read more >
Evaluate boolean environment variable in Python
Option 1. I think this works well: my_env = os.getenv("ENV_VAR", 'False').lower() in ('true', '1', 't').
Read more >
Cypress-tags - npm.io
Select tests by passing a boolean expression of tags using AND and OR to the Cypress environment variable CYPRESS_INCLUDE_EXPRESSION .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found