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

Upgrading Cypress from 4.0.1 to 4.3.0 results in conflicting jquery typedefs #7063

Closed
dnaverdo opened this issue Apr 18, 2020 · 5 comments
Closed
Labels
topic: typescript v4.3.0 🐛 Issue present since 4.3.0

Comments

@dnaverdo
Copy link

dnaverdo commented Apr 18, 2020

Current behavior:

Upgrading Cypress from 4.01 to 4.3.0 results in conflicting jquery typedefs since jquery puts a bunch of stuff on the global scope.

Desired behavior:

No conflicting typedefs

Test code to reproduce

Have a product using jquery 2
Upgrade from cypress 4.0.1 to 4.3
Observe yarn.lock:

[email protected]:
  version "4.3.0"
  resolved "https://registry.yarnpkg.com/cypress/-/cypress-4.3.0.tgz#74694c2407846119368a6aecc456b3ee1a8ee32b"
  integrity sha512-xO1oef4ns4koDAkQROGJIhKKhGHDOKfOmlirwP1QAk9w/no+YJpN7HZ6IUPiXwWw3C7xVLjScoI8Dad0z5uTTg==
  dependencies:
    "@cypress/listr-verbose-renderer" "0.4.1"
    "@cypress/request" "2.88.5"
    "@cypress/xvfb" "1.2.4"
    "@types/blob-util" "1.3.3"
    "@types/bluebird" "3.5.29"
    "@types/chai" "4.2.7"
    "@types/chai-jquery" "1.1.40"
    "@types/jquery" "3.3.31"

"@types/jquery@*", "@types/jquery@2":
  version "2.0.49"
  resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.49.tgz#95bd7064caebf65bde10429dff491a1aea05b67d"

"@types/[email protected]":
  version "3.3.31"
  resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.31.tgz#27c706e4bf488474e1cb54a71d8303f37c93451b"
  integrity sha512-Lz4BAJihoFw5nRzKvg4nawXPzutkv7wmfQ5121avptaSIXlDNJCUuxZxX/G+9EVidZGuO0UBlk+YjKbwRKJigg==
  dependencies:
    "@types/sizzle" "*"

Versions

4.0.1, 4.3.0

@jennifer-shehane jennifer-shehane added topic: typescript v4.3.0 🐛 Issue present since 4.3.0 labels Apr 20, 2020
@jennifer-shehane
Copy link
Member

Maybe related to #5780? cc @sainthkh

@cypress-bot cypress-bot bot added the stage: needs investigating Someone from Cypress needs to look at this label Apr 20, 2020
@sainthkh
Copy link
Contributor

sainthkh commented Apr 20, 2020

Confirmed.

I created a simple project like below:

// package.json
{
  "name": "7063",
  "dependencies": {
    "@types/jquery": "2.0.54",
    "cypress": "4.3.0",
    "jquery": "2.2.4",
    "typescript": "^3.8.3"
  }
}
// index.ts
/// <reference types="cypress" />
import $ from 'jquery'

context('Actions', () => {
  it('.type() - type into a DOM element', () => {
    cy.visit('https://example.cypress.io/commands/actions')
    $('.x').append('1234')
  })
})

Compile index.ts with:

./node_modules/.bin/tsc --noEmit --esModuleInterop --lib dom,es5,es6  index.ts

Found 61 errors.

@cypress-bot cypress-bot bot added stage: work in progress and removed stage: needs investigating Someone from Cypress needs to look at this labels Apr 21, 2020
@sainthkh
Copy link
Contributor

I've investigated the problem and concluded that I need more information. With my current setting, the type clash happen even when Cypress is 1.2.0.

Because from the beginning (#1044, #1048), index.d.ts started with jQuery 3.x types.

This repo is the test repo I used. I tested types with ./node_modules/.bin/tsc --noEmit --esModuleInterop --lib dom,es5,es6 cypress/integration/examples/action.spec.ts.

Can you provide me a repo with codes that works before 4.3.0 but fails after it and how to test it?

@cypress-bot cypress-bot bot added stage: ready for work The issue is reproducible and in scope and removed stage: work in progress labels Apr 27, 2020
@sainthkh sainthkh added stage: awaiting response Potential fix was proposed; awaiting response and removed stage: ready for work The issue is reproducible and in scope labels Apr 27, 2020
@cypress-bot cypress-bot bot added stage: needs information Not enough info to reproduce the issue and removed stage: awaiting response Potential fix was proposed; awaiting response labels Apr 27, 2020
@sainthkh
Copy link
Contributor

sainthkh commented Jun 2, 2020

@dnaverdo In #7352, @types are removed. I guess your project might work with 4.6.0 and above.

@dnaverdo
Copy link
Author

dnaverdo commented Jun 4, 2020

it does work again... thanks for the note!

@dnaverdo dnaverdo closed this as completed Jun 4, 2020
@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: typescript v4.3.0 🐛 Issue present since 4.3.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants