Skip to content

Not able to generate code coverage report on running vue 3 (typescript) application on a headless mode #29276

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

Closed
elangoRamar opened this issue Apr 5, 2024 · 3 comments
Labels
CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period topic: code coverage

Comments

@elangoRamar
Copy link

elangoRamar commented Apr 5, 2024

Current behavior

I am trying to generate the cypress code coverage report when i run the tests on a headless mode. But it's not generating the report.

And it's creating the report on interactive mode(cypress open -e2e).

Vue project dependency version:
"vue": "^3.4.21",
"vite": "^5.2.7",

And i am using "nyc": "^15.1.0" and "vite-plugin-istanbul": "^6.0.0" to generate the report.

Even i tried adding "@istanbuljs/nyc-config-typescript": "^1.0.2" and .nycrc configuration also not working.

Desired behavior

No response

Test code to reproduce

vite.config.ts

export default defineConfig({
  plugins: [
    vue(),
    vuetify({ autoImport: true }),
    istanbul({
      cypress: true,
      include: ['src/*'],
      exclude: ['node_modules'],
      extension: ['.js', '.ts', '.vue'],
      requireEnv: false
    })
  ],
  build: {
    sourcemap: true,
  }
});

cypress.config.js

import coverageTask from "@cypress/code-coverage/task";

export default defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      coverageTask(on, config)
      return config;
    }
  }
});

cypress/support/e2e.ts
import '@cypress/code-coverage/support'

command: cypress run --e2e

Cypress Version

13.7.2

Node version

20.12.0

Operating System

macOs 14

Debug Logs

getting below message,

Cannot find coverage file /Users/<user>/Documents/<project>/.nyc_output/out.json
Skipping coverage report

Other

No response

@cacieprins cacieprins added the stage: needs investigating Someone from Cypress needs to look at this label Apr 5, 2024
@jennifer-shehane jennifer-shehane added topic: code coverage CT Issue related to component testing labels Apr 12, 2024
@jennifer-shehane
Copy link
Member

I know there’s some comments in this thread about getting code coverage setup for ct testing, some of it may help you with a workaround. cypress-io/code-coverage#596

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Oct 10, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this stale no activity on this issue for a long period topic: code coverage
Projects
None yet
Development

No branches or pull requests

4 participants