Skip to content

Missing @cypress/code-coverage/use-browserify-istanbul in 3.10.0 release #573

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

Open
tvsbrent opened this issue May 31, 2022 · 7 comments
Open

Comments

@tvsbrent
Copy link

tvsbrent commented May 31, 2022

Logs and screenshots

Opening Cypress...
objc[12069]: Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x7ffb550fc948) and /Users/bschmidt/Library/Caches/Cypress/9.7.0/Cypress.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x1145b59c8). One of the two will be used. Which one is undefined.
Your pluginsFile threw an error from: /Users/bschmidt/development/oreilly/four_o_four_service/cypress/plugins/index.js

Error: Cannot find module '@cypress/code-coverage/use-browserify-istanbul'

Versions

Version 3.10.0

Describe the bug
With the release of the 3.10.0 version of @cypress/code-coverage, the use-browserify-istanbul entry point is missing. In looking at the release, it appears this commit for Cypress 10 compatibility introduced it. However, the entrypoint is still referenced in the README, so I'm assuming that removing that file was a breaking change intended for a major release.

Link to the repo
n/a

@Fewwy
Copy link

Fewwy commented Jun 2, 2022

I stumbled upon the same issue

stefcameron added a commit to focus-trap/tabbable that referenced this issue Jun 9, 2022
Ran `cypress open` and walked through migration guide. It generated cypress.config.ts
which I renamed to cypress.config.js and reverted to `require()` instead of `import`
because of stupid TypeScript typings warnings related to the plugins, which seem
perfectly fine.

e2e tests all run and pass as before.

Unfortunately, coverage is broken because we also need
`@cypress/[email protected]` which supports Cypress 10, but
it has an issue with this error:
cypress-io/code-coverage#573
stefcameron added a commit to focus-trap/tabbable that referenced this issue Jun 15, 2022
Ran `cypress open` and walked through migration guide. It generated cypress.config.ts
which I renamed to cypress.config.js and reverted to `require()` instead of `import`
because of stupid TypeScript typings warnings related to the plugins, which seem
perfectly fine.

e2e tests all run and pass as before.

Unfortunately, coverage is broken because we also need
`@cypress/[email protected]` which supports Cypress 10, but
it has an issue with this error:
cypress-io/code-coverage#573
stefcameron added a commit to focus-trap/tabbable that referenced this issue Jun 16, 2022
* [DEPENDABOT]: Bump cypress from 9.7.0 to 10.0.3

Bumps [cypress](https://github.com/cypress-io/cypress) from 9.7.0 to 10.0.3.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](cypress-io/cypress@v9.7.0...v10.0.3)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Migrate to Cypress 10

Ran `cypress open` and walked through migration guide. It generated cypress.config.ts
which I renamed to cypress.config.js and reverted to `require()` instead of `import`
because of stupid TypeScript typings warnings related to the plugins, which seem
perfectly fine.

e2e tests all run and pass as before.

Unfortunately, coverage is broken because we also need
`@cypress/[email protected]` which supports Cypress 10, but
it has an issue with this error:
cypress-io/code-coverage#573

* Remove lint

* Fix lock file conflict

* Apparent must still specify cypress config file?

* No difference, reverted, but now bumped Cypress version in CI, hoping...

* Try with updated Cypress GH Action

* Disable broken code coverage

* Try cypress/code-coverage 3.9.x for fun

* Revert "Try cypress/code-coverage 3.9.x for fun"

This reverts commit 68e1d03.

3.9.x fails with the same missing reference error.

* Update lock file for some reason (unexpected)

* Update how cypress/code-coverage plugin is installed/configured

https://docs.cypress.io/guides/tooling/code-coverage#Install-the-plugin

Found a reference to this path that has been the problem so far:

```javascript
    on(
      'file:preprocessor',
      require('@cypress/code-coverage/use-browserify-istanbul')
    );
```

Removed since that's not in the installation instructions (maybe it
was at one point, but no longer).

* See if Codecov GH Action will make everything better

Instead of manually installing codecov globally and running it...

References:

- https://github.com/marketplace/actions/codecov
- https://relatablecode.com/how-to-add-cypress-codecov-in-github-actions-in-react-app

* cypress/code-coverage does NOT instrument the code for you...

https://github.com/cypress-io/code-coverage#instrument-unit-tests

Ah. Finally, circle right back to the original issue of the ellusive
`@cypress/code-coverage/use-browserify-istanbul` reference which
no longer exists in version 3.10.0 of `@cypress/code-coverage`.

The only thing cypress/code-coverage provides now is
`@cypress/code-coverage/use-babelrc`, which has peer dependencies
on webpack, babel-loader, babel/preset-env and babel/core.

After all those added, and babel.config.js configured under 'test'
env (and added `BABEL_ENV=test` to package.json 'test:coverage'
script that runs Cypress with coverage option), things are
looking good locally with .nyc_output/out.json once again generated.

Let's see if it works and reports in GH Actions now.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefan Cameron <[email protected]>
@stefcameron
Copy link

Well that was "fun": focus-trap/tabbable#692 (my journey upgrading from Cypress 9.x to 10.0.3), particularly foiled by this very issue.

In the end, it came down to this old code that was still referencing the now-missing dependency:

    on(
      'file:preprocessor',
      require('@cypress/code-coverage/use-browserify-istanbul')
    );

That needed to be replaced with the only one that remains in the 3.10.0 package now, which is @cypress/code-coverage/use-babelrc...

Here's the commit message from the changes that finally got stuff working again:

cypress/code-coverage does NOT instrument the code for you...

https://github.com/cypress-io/code-coverage#instrument-unit-tests

Ah. Finally, circle right back to the original issue of the ellusive
`@cypress/code-coverage/use-browserify-istanbul` reference which
no longer exists in version 3.10.0 of `@cypress/code-coverage`.

The only thing cypress/code-coverage provides now is
`@cypress/code-coverage/use-babelrc`, which has peer dependencies
on webpack, babel-loader, babel/preset-env and babel/core.

After all those added, and babel.config.js configured under 'test'
env (and added `BABEL_ENV=test` to package.json 'test:coverage'
script that runs Cypress with coverage option, as well as GH ci.yml),
things are looking good locally with .nyc_output/out.json once again
generated.

Let's see if it works and reports in GH Actions now.

@magarwal19-wellsky
Copy link

It is failing for me also, any alternate to fix this and get code coverage?

@cjinhuo
Copy link

cjinhuo commented Mar 24, 2023

I have the same issue. It has been for almost one year. Does this issue have ignored?

@uniqname
Copy link

uniqname commented Apr 5, 2023

This is made all the more confusing because the current docs still reference browserify as an option. Further, there is no indication in commit messages that this was removed, and it was removed on a minor release. At a minimum the Readme should be updated to not reference browserify as an option.

@kayeew
Copy link

kayeew commented Aug 10, 2023

Any updates on this issue? I am trying to set this up in my project and facing the same issue now. Help anyone?

EDIT: am using cypress v12.17.2

@mrdulin
Copy link

mrdulin commented Jul 3, 2024

+1 for "@cypress/code-coverage": "^3.12.39"

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

No branches or pull requests

8 participants