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

Created on 21 May 2019  路  11Comments  路  Source: cypress-io/cypress

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"
    }

typescript bug

All 11 comments

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?

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 :))

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.

Is anybody looked at this issue?

@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!

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

@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 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.

@Postavshik I have changed the reference comment and added a few sinon-chai tests in https://github.com/cypress-io/cypress/pull/4382 let's see if that solves the issue when it is released

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.

Released in 3.3.2.

Was this page helpful?
0 / 5 - 0 ratings