Hi Everyone - I’m new to this community but I was hoping to get some help with a code coverage issue
I’m trying to generate and save an LCOV 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 instanbul babel plugin, and a .coverage.json file.
I’ve also written an npm script (named “test-cov”) which includes the necessary env variables to run the test with coverage.
However, when I run “npm run test-cov”, all the tests pass but I keep getting the following error about the coverage file not saving:
Switching between the absolute path for ‘output’ in coverage.json file and relative path (./.coverage)
Moving lmieulet:meteor-coverage package higher up in ./.meteor/packages folder
Adding TEST_BROWSER_DRIVER=chrome to the “test-cov” script and removing TEST_CLIENT=0 (even though we only have server tests anyway)
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…
Could still be a permissions issue since tests are run from a temporary directory with symlinks back to the source and other directories but I’m just guessing
thanks for the suggestion - just tried it with 3.2.0 but it didn’t work. Another thought is that my meteor version is a bit old (1.11.1) - could that have something to do with it?
It may be permissions… but we’ve tried to make sure the folder permissions are pretty open and also have tried running as sudo and neither seem to work
For posterity’s sake: the problem was that nock was the coverage package’s ability to write the LCOV file once the testing was finished. If you’re using nock and experience a similar error, use nock.enableNetConnect() to fix