Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test-level config env replaces (rather than merges with) suite-level config env #16079

Closed
tricus opened this issue Apr 20, 2021 · 2 comments
Closed
Labels

Comments

@tricus
Copy link

tricus commented Apr 20, 2021

Current behavior

When a suite is provided a config argument with an env property, and a contained test is also provided a config argument with an env property, the test's env entirely replaces the suite's env.

Desired behavior

Properties of the test's config env should override/merge into the suite's config env, similarly to how the rest of the config/env overrides work.

Test code to reproduce

describe('Suite with a config env',
  { env: {
      var0: 'I was set on the suite!',
      var1: 'I was set on the suite!'
  }},
  () => {
    it('Test with a config env',
      { env: { var1: 'I was set on the test!' } },
      () => {
        expect(Cypress.env('var0')).to.exist.and.to.equal('I was set on the suite!') // AssertionError: expected undefined to exist
        expect(Cypress.env('var1')).to.exist.and.to.equal('I was set on the test!')
    })
})

Versions

Cypress 7.1.0

@bahmutov
Copy link
Contributor

Reproduction in https://github.com/cypress-io/cypress-test-tiny/tree/env-merge

Yeah, it should merge the environment objects

@emilyrohrbough
Copy link
Member

@tricus Thank you for logging this issue. I was able to reproduce your issue with Cypress 9.2.1. This does appear to be a duplicate of #8005, so I'm closing in favor of the older issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants