circleCI fails when it tries to run this command:
#!/bin/bash --login
cat ./coverage/coverage.json | ./node_modules/.bin/adana --format lcov | ./node_modules/coveralls/bin/coveralls.js
[error] "2019-02-20T20:22:50.695Z" 'error from lcovParse: ' 'Failed to parse string'
[error] "2019-02-20T20:22:50.697Z" 'input: ' '\n'
[error] "2019-02-20T20:22:50.697Z" 'error from convertLcovToCoveralls'
/home/ubuntu/Band-of-Coders/uber-auth/node_modules/coveralls/bin/coveralls.js:18
throw err;
^
Failed to parse string
Exited with code 1
this it is how I run my tests:
./node_modules/.bin/_mocha -r test/helper/chai.js -r adana-dump --compilers js:babel-core/register -R spec --recursive --slow 100 test/spec/**/*.spec.js
In my .circleci/config.yml, I have:
- run: npm test
- run: npm install coveralls
- run: cat ./coverage/coverage.json | ./node_modules/.bin/adana --format lcov | ./node_modules/coveralls/bin/coveralls.js
any thoughts about why this is happening? I really appreciate any help
You might need to make use of nyc
with babel-plugin-istanbul
or plain istanbul
to generate the coverage data first before you run your coverage reporting script. Otherwise, there'd be no data available to generate a report.
I've used nyc
with babel-plugin-istanbul
before and got expected results.
"test": "NODE_ENV=test nyc ./node_modules/.bin/_mocha <your-test-matching-wildcard-here>",
"coveralls": "NODE_ENV=test nyc report --reporter=text-lcov | coveralls"
You'll also need to have some configuration in your .nycrc
:
{
"reporter" : ["text", "text-summary", "lcov", "html"],
"include" : ["<your-include-wildcard>"],
"exclude" : ["<your-exclude-wildcard>"],
"require" : ["@babel/register"],
"sourceMap" : false,
"instrument" : false,
"all" : true
}
Run test script first then coveralls.