Mocha lmieulet:meteor-coverage code coverage error - failed to save

Viewed 21

I’m trying to generate and save an LCOV code coverage report file from a mocha test suite for my server in my (non-Typescript) Meteor app. To enable this, I’ve added the lmieulet:meteor-coverage meteor package, the meteortesting:mocha meteor package, and the instanbul babel plugin.

I've also written a ./.coverage.json file:

{
  "include": [
    "**/*.js",
    "**/packages/lmieulet_meteor-coverage.js"
  ],
  "remap": {
    "format": ["html", "clover", "cobertura", "json", "json-summary", "lcovonly", "teamcity", "text", "text-summary"]
  },
  "output": "./.coverage"
}

And added config for the babel plugin in package.json:

    "babel": {
        "env": {
            "COVERAGE": {
                "plugins": [
                    "istanbul"
                ]
            }
        }
    }

And I’ve written an npm script (named “test-cov”) which includes the necessary env variables to run the test with coverage.

cross-env BABEL_ENV=COVERAGE TEST_CLIENT=0 COVERAGE_OUT_LCOVONLY=1 COVERAGE=1 COVERAGE_VERBOSE=1 COVERAGE_APP_FOLDER=$(pwd)/ meteor test --port 3030 --once --driver-package meteortesting:mocha

With all this set up, I'm expecting the code coverage report to successfully generate when I run "npm run test-cov".

However, when I do run it, I keep getting the following error: Error: Failed to save lcov coverage... at packages/meteortestingLmocha/server.handlecoverage.js:37:18

I’ve tried:

  • Switching between the absolute path for ‘output’ in coverage.json file and relative path (./.coverage)
  • Updating the versions of meteortesting:mocha as well as the overall Meteor version of my app
  • Opening chmod permissions to 777 for ./.coverage folder (to be written into)

One complication may be that we also have a second testing suite (Jest), but I don’t believe that’s being invoked anywhere as a result of running “test-cov”

Does anyone have an idea of why this isn’t working? I’m at a loss about what to do, partly because the error message here is so brief…

0 Answers
Related