Skip to content
New issue

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

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

Already on GitHub? # to your account

Cypress resolves import incorrectly? #1035

Closed
tan-nhu opened this issue Dec 7, 2017 · 1 comment
Closed

Cypress resolves import incorrectly? #1035

tan-nhu opened this issue Dec 7, 2017 · 1 comment
Labels
stage: wontfix Cypress does not regard this as an issue or will not implement this feature

Comments

@tan-nhu
Copy link

tan-nhu commented Dec 7, 2017

  • Operating System: Mac 10.12.6
  • Cypress Version: 1.1.4
  • Browser Version: Chrome 62

Is this a Feature or Bug?

Bug

Current behavior:

When two test files import a same module, cypress resolves each import from scratch instead using the same reference. This behavior is different from node/require imports.

Desired behavior:

Cypress should import modules the same as node.

How to reproduce:

cypress/utils.js:

export const key = +new Date()

cypress/integration/test1.js

import { key } from '../utils'

describe('Foo1', () => {
  it('Bar1', () => {
    cy.log(key)
  })
})

cypress/integration/test2.js

import { key } from '../utils'

describe('Foo2', () => {
  it('Bar2', () => {
    cy.log(key)
  })
})

When running all, cypress logs two different keys. The same import in nodejs results the same key.

Additional Info (images, stack traces, etc)

cypress-test.zip

@tan-nhu tan-nhu changed the title Cypress resolves import incorrectly Cypress resolves import incorrectly? Dec 7, 2017
@brian-mann
Copy link
Member

Cypress serves each spec in isolation - which is the correct and intended behavior.

We are actually moving more towards this way, which will become the default enforced behavior on all runs. You can read more here: #681

@brian-mann brian-mann added the stage: wontfix Cypress does not regard this as an issue or will not implement this feature label Dec 7, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
stage: wontfix Cypress does not regard this as an issue or will not implement this feature
Projects
None yet
Development

No branches or pull requests

2 participants