cypress-io / code-coverage

Saves the code coverage collected during Cypress tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug - test-utils.js needs updated when loading .nycrc.yaml files

tommyc38 opened this issue · comments

Logs and screenshots
Please provide debug logs by running Cypress from the terminal with DEBUG=code-coverage environment variable set, see the Debugging section of the README file.

Screenshot 2023-08-11 at 8 55 51 AM

Versions

  • What is this plugin's version? If this is NOT the latest released version can you try the latest version, please?
  • If the plugin worked before in version X, but stopped after upgrading to version Y, please try the released versions between X and Y to see where the breaking change was.
  • What is Cypress version? "cypress": "^12.17.3",
  • What is your operating system?
    I tried this locally (latest MacOS) as well as in my ci docker container with the same result:
    cypress/browsers:node16.16.0-chrome107-ff107-edge
    https://github.com/cypress-io/cypress-docker-images/tree/master/included - link to cypress/node images
    image: cypress/included:12.3.0
  • What is the shell? bash
  • What is the Node version? 16.16.0
  • What is the NPM version?
  • How do you instrument your application? Cypress does not instrument web application code, so you need to do it yourself. I do this with webpack config and confirm it works.
  • When running tests, if you open the web application in regular browser, and open DevTools, do you see window.__coverage__ object? Can you paste a screenshot?
  • Is there .nyc_output folder? Is there .nyc_output/out.json file. Is it empty? Can you paste at least part of it so we can see the keys and file paths?
  • Do you have any custom NYC settings in package.json (nyc object) or in other NYC config files. Yes, I use a .nycrc.yaml file.
  • Do you run Cypress tests in a Docker container? Yes, see above info on the docker image for my ci.

Describe the bug
My .nycrc.yaml file is blowing up cypress e2e tests. I have monkey patched test-utils.js to swap out yaml.safeLoad with yaml.load and everything works.

Link to the repo
Bugs with a reproducible example, like an open source repo showing the bug, are the most likely to be resolved.

Example
See #217 that is an excellent bug report example

An alternative to a monkey-patch is to override the dependency

  "overrides": {
    "@cypress/code-coverage": {
      "js-yaml": "<4.0"
    }
  },

looks like the bump was made by a bot and code-coverage still works fine without it #371