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

Cypress 3.3.1/3.3.0/3.2.0: Error TS2688: Cannot find type definition file for '../sinon' #4272

Closed
Postavshik opened this issue May 21, 2019 · 11 comments

Comments

3 participants
@Postavshik
Copy link

commented May 21, 2019

Current behavior:

After I have upgraded from Cypress 3.1.5 to 3.3.0, Cypress is throwing the error on compile

TypeScript error: node_modules/cypress/types/sinon-chai/index.d.ts(10,23): Error TS2688: Cannot find type definition file for '../sinon'.

Then I have tried 3.2.0 and had the same issue. When revered to 3.1.5 - issue is gone.

I have tried to remove node_modules, clear npm cash and make a clean installation for every version of Cypress. No luck.

2019-05-21_1010

Desired behavior:

3.2.0 and 3.3.0 should compile and run tests without issues.

Steps to reproduce: (app code and test code)

Versions

Cypress: 3.3.0/3.2.0
macOS Mojave v.10.14.5
Chrome 74, Electron 59/61

Package.json

"devDependencies": {
        "@angular-devkit/build-angular": "^0.13.8",
        "@angular/cli": "~6.1.2",
        "@angular/compiler-cli": "^6.1.0",
        "@angular/language-service": "^6.1.0",
        "@cypress/browserify-preprocessor": "^1.1.2",
        "@storybook/addon-actions": "^5.0.10",
        "@storybook/addon-links": "^5.0.10",
        "@storybook/addon-notes": "^5.0.10",
        "@storybook/addons": "^5.0.10",
        "@storybook/angular": "^5.0.10",
        "@types/jest": "^23.3.1",
        "@types/new-relic-browser": "0.1072.3",
        "@types/node": "~8.9.4",
        "@types/popper.js": "1.11.0",
        "@types/react": "^16.4.8",
        "@types/webpack-env": "^1.13.6",
        "babel-loader": "^8.0.5",
        "codelyzer": "~4.2.1",
        "cypress": "3.3.0",
        "cypress-cucumber-preprocessor": "^1.6.0",
        "del-cli": "^1.1.0",
        "husky": "^1.1.2",
        "icon-font-generator": "^2.1.8",
        "jest": "^23.4.2",
        "jest-canvas-mock": "^1.1.0",
        "jest-date-mock": "^1.0.5",
        "jest-preset-angular": "^6.0.0",
        "jest-teamcity-reporter": "^0.9.0",
        "json-sass": "^1.3.5",
        "lint-staged": "^7.2.0",
        "node-sass": "^4.12.0",
        "prettier": "^1.14.1",
        "protractor": "^5.4.1",
        "start-server-and-test": "^1.7.13",
        "ts-node": "~5.0.1",
        "tsify": "^4.0.1",
        "tslint": "~5.9.1",
        "tslint-config-prettier": "^1.14.0",
        "typescript": "^2.9.2"
    }
@bahmutov

This comment has been minimized.

Copy link
Collaborator

commented May 21, 2019

can you try something for me please? Can you edit the file node_modules/cypress/types/sinon-chai/index.d.ts and replace the error line 10

/// <reference types="../sinon" />

with

/// <reference path="../sinon/index.d.ts" />

and see if it solves this for you?

@Postavshik

This comment has been minimized.

Copy link
Author

commented May 21, 2019

I have two of those links in the file.
2019-05-21_1046

Once I have removed
/// <reference types="../sinon" />

It s working now.

Thank you for your help :))

@Postavshik Postavshik closed this May 21, 2019

@Postavshik Postavshik reopened this May 24, 2019

@Postavshik Postavshik changed the title Cypress 3.3.0/3.2.0: Error TS2688: Cannot find type definition file for '../sinon' Cypress 3.3.1/3.3.0/3.2.0: Error TS2688: Cannot find type definition file for '../sinon' May 24, 2019

@Postavshik

This comment has been minimized.

Copy link
Author

commented May 24, 2019

The quick fix with removing of

/// <reference types="../sinon" />

It worked.

Updated to cypress 3.3.1 today and this crashed cypress again because of the same issue.
Can somebody fix this in the node_modules and remove this import from cypress? I am blocked to use cypress in CI/CD because of this issue. I have to roll back to 3.1.5.

@Postavshik

This comment has been minimized.

Copy link
Author

commented May 30, 2019

Is anybody looked at this issue?

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jun 3, 2019

@Postavshik Can you provide what is logged to the stdout during the 'crash' of Cypress? Could you run Cypress in debug mode mode and print the logs here? Thanks!

@Postavshik

This comment has been minimized.

Copy link
Author

commented Jun 3, 2019

@jennifer-shehane isn't the screenshot above with the error not what your are asking about?

@bahmutov

This comment has been minimized.

Copy link
Collaborator

commented Jun 4, 2019

@Postavshik this is very weird, since other people (and we ourselves) do not see this issue happening. Might be this specific version of TypeScript. As a precaution, let me change the comment to use path

@bahmutov bahmutov self-assigned this Jun 4, 2019

@Postavshik

This comment has been minimized.

Copy link
Author

commented Jun 4, 2019

@bahmutov Yup, sound strange. We have tried it on different computers mac and windows. All computers had the same issue as mine. I have tried to change typescript to the latest (my current version is 2.9.2), but it didn't work as well.

@bahmutov

This comment has been minimized.

Copy link
Collaborator

commented Jun 4, 2019

@Postavshik I have changed the reference comment and added a few sinon-chai tests in #4382 let's see if that solves the issue when it is released

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 4, 2019

The code for this is done in cypress-io/cypress#4382, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot

This comment has been minimized.

Copy link

commented Jun 27, 2019

Released in 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.