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

does not work with --project flag of cypress #320

Closed
cellog opened this issue Oct 13, 2020 · 2 comments
Closed

does not work with --project flag of cypress #320

cellog opened this issue Oct 13, 2020 · 2 comments
Labels
question Further information is requested

Comments

@cellog
Copy link

cellog commented Oct 13, 2020

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.

Because this plugin requires accessing package.json in order to find nyc parameters, it does not work with the --project flag of Cypress. This is because it will look for package.json in the project directory, rather than the actual root directory where package.json lives.

If one tries to get sneaky and add a package.json into the project directory, this causes the code coverage to limit to only files in the project directory.

We are using the unit test plugin to allow writing tests that are co-located with the source files, and the Cypress config is in a separate directory, so that we can use Cypress separately for other integration testing use cases.

The only sane solution is to allow passing in an nyc config directly to the @cypress/code-coverage/task plugin. Requiring modifying package.json is all kinds of impossible-to-work-with.

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?
  • What is your operating system?
  • What is the shell?
  • What is the Node version?
  • 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.
  • 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
  • Do you run Cypress tests in a Docker container?

Describe the bug
A clear and concise description of what the bug is.

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

@bahmutov
Copy link
Contributor

I don't think I understand the situation. Can you make a public repo showing the problem? You don't need to put your code there, just some example code.

The reason is that this repo is testing the examples using --project ... subfolders. So to better understand what is happening I would love to see the actual code structure.

@bahmutov bahmutov added the question Further information is requested label Nov 23, 2020
@bahmutov
Copy link
Contributor

Closing due to inactivity

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

No branches or pull requests

2 participants