question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nyc out.json is empty

See original GitHub issue

vue/node js project running with cypress tests, trying to add coverage the nyc_output folder is there also the processinto folder The out.json file is either empty or not created, depending on how i play with the setting files I also see in the cypress run that the after all task - covergereport runs, but the after each task - combine coverge does not run

my plugins index file has the

on('task', require('@cypress/code-coverage/task'))

my babel

"babel": {
    "plugins": ["istanbul"],
    "presets": [
      [
        "@babel/preset-env",
        {
          "modules": "commonjs",
          "targets": {
            "node": "current"
          }
        }
      ]
    ]

nycrc
{
        "extends": "@istanbuljs/nyc-config-babel",
        "extension": [".js", ".vue"],
        "all": true
}

my command line

nyc --all npm run test:open

my json has

"devDependencies": {
    "@babel/core": "^7.5.0",
    "@babel/preset-env": "^7.5.2",
    "@cypress/code-coverage": "^1.10.1",
    "@vue/cli-plugin-babel": "^3.8.0",
    "@vue/cli-plugin-eslint": "^3.8.0",
    "@vue/cli-plugin-unit-jest": "^3.7.0",
    "@vue/cli-service": "^3.8.0",
    "@vue/eslint-config-standard": "^4.0.0",
    "@vue/test-utils": "^1.0.0-beta.29",
    "axios-mock-adapter": "^1.17.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.0.1",
    "babel-jest": "^22.4.3",
    "babel-plugin-component": "^1.1.1",
    "babel-plugin-istanbul": "^5.2.0",
    "cypress": "^3.4.1",
    "cypress-failed-log": "^2.5.1",
    "eslint": "^5.16.0",
    "eslint-plugin-cypress": "^2.0.1",
    "eslint-plugin-cypress-dev": "2.1.0",
    "eslint-plugin-jest": "^22.7.2",
    "eslint-plugin-mocha": "5.3.0",
    "eslint-plugin-vue": "^5.0.0",
    "gulp-babel": "^8.0.0",
    "istanbul-lib-coverage": "^2.0.5",
    "jest": "^24.8.0",
    "jest-html-reporter": "^2.5.0",
    "jest-junit": "^6.4.0",
    "jest-transform-stub": "^2.0.0",
    "nodemon": "^1.19.1",
    "nyc": "^14.1.1",
    "sass": "^1.18.0",
    "sass-loader": "^7.1.0",
    "start-server-and-test": "^1.10.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "supertest": "^4.0.2",
    "supertest-as-promised": "^4.0.2",
    "vue-cli-plugin-vuetify": "^0.5.0",
    "vue-jest": "^3.0.4",
    "vue-template-compiler": "^2.6.10",
    "vue-test-utils": "^1.0.0-beta.11",
    "vuetify-loader": "^1.0.5",
    "vuex-mock-store": "0.0.7",
    "wait-on": "^3.3.0"

what am i missing?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
leorigoncommented, Oct 1, 2019

We have the same problem here 😦

3reactions
KarimElKhashabcommented, Jul 17, 2020

I’m facing a problem where the window.coverage is always coming “undefined” even after following all the Cypress code coverage documentation steps with various instrumentation options mentioned… and when starting my server with the cmd

  "scripts": {
    "start": "PORT=7777 react-app-rewired -r @cypress/instrument-cra start",
}

I get the following error

EvalError: Refused to evaluate a string as JavaScript because ‘unsafe-eval’ is not an allowed source of script in the following Content Security Policy directive: "script-src ‘self’ ‘unsafe-inline’

Appreciate your help on this @bahmutov

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress with Istanbul is not generating code coverage reports
Running tests in Cypress is generating seemingly correct .nyc_output/out.json file with numbers how many times some lines were executed.
Read more >
@cypress/code-coverage - Awesome JS
If the out.json file does not have information for some files that should be there according to include list, then an empty placeholder...
Read more >
@cypress/code-coverage - npm
Saves the code coverage collected during Cypress tests. Latest version: 3.10.0, last published: 7 months ago.
Read more >
Triple combined code coverage for React Apps with Jest ...
Note that .nyc folder gets populated with out.json as we run Cypress ... because nyc merge reports yields an empty coverage.json file while ......
Read more >
Generate report from __coverage__ object - Istanbul
Output the contents of window.__coverage__ (assuming it's in Istanbul 1.0 format) to .nyc_output/out.json . To generate HTML report for example, run:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found