masakudamatsu / mima

My Ideal Map, a web app to allow users to save places with **external links** on Google Maps
https://www.my-ideal-map.app
MIT License
1 stars 0 forks source link

Fix Cypress code coverage #238

Open masakudamatsu opened 2 years ago

masakudamatsu commented 2 years ago

Problem

Cypress 10 requires @cypress/code-coverage@3.10.0.

But code-coverage@3.10.0 fails to run with the following error:

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

This is a known issue: https://github.com/cypress-io/code-coverage/issues/573

Solution 1

A solution (cited in this post) is:

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

Solution 2

When I set up the coverage report for Cypress, I went with the approach using use-browserify-istanbul, as described in the official readme. See cypress/plugins/index.js in my repo.

I can try an alternative approach, also described in the official readme.

Solution 3

Start from scratch: read Cypress docs on code coverage.

masakudamatsu commented 2 years ago

For the time being, we stop Cypress from reporting code coverage.

Before the first release, we'll investigate this issue again.