coveralls github integration (with qunit, istanbul, grunt)
Asked Answered
H

1

6

I'm having issues getting coveralls to work. I've created a simple project here.

It seems to be outputting the report correctly, but I'm definitely missing a step somewhere because coveralls doesn't see me as being set up. No branches show up, and it simply gives instructions on how to set it up. I've tried to copy what qunit is doing, because they obviously have it working.

Here is what I've done so far.

Created the project that uses node/grunt/qunit as well as the coveralls account and toggled on the project. I've then replaced the qunit reference in the devDependencies section in package.json with this.

"grunt-coveralls": "0.3.0",
"grunt-qunit-istanbul": "^0.4.0"

I've added this to my package.json.

"scripts": {
    "ci": "grunt && grunt coveralls"
}

I've added this config for qunit in my Gruntfile.js.

options: {
    timeout: 30000,
    "--web-security": "no",
    coverage: {
        src: [ "src/<%= pkg.name %>.js" ],
        instrumentedFiles: "temp/",
        coberturaReport: "report/",
        htmlReport: "build/report/coverage",
        lcovReport: "build/report/lcov",
        linesThresholdPct: 70
    }
},

I then added this to my .travis.yml.

language: node_js

node_js:
    - "0.10"
before_install: 
    npm install -g grunt-cli
install: 
    npm install
before_script: 
    grunt
after_script:
    npm run-script coveralls
Harte answered 18/3, 2014 at 20:19 Comment(0)
H
4

I got it working, check the repo for the example https://github.com/thorst/Code-Coverage-Qunit

While its not always possible, I found jasmine to be easier in multiple ways. I have a complete example here: https://github.com/thorst/Code-Coverage-Jasmine

I still haven't gotten mocha to work though. That (broken) repo is here: https://github.com/thorst/Code-Coverage-Mocha

Harte answered 20/3, 2014 at 0:49 Comment(5)
What did you have to change to get this working? Did you just have to add grunt coveralls under script:?Dorkus
that was one of the changes, to be honest there were so many things i was trying im not sure what all i had, and what all i changed. But it is working now. And i even have the patch for debugging locally on windowsHarte
Adding grunt coveralls under script: is what did it for me. Honestly, the documentation for this is quite terrible. There is a ton of contradictory information out there, and information that plain just does not work.Dorkus
that's why i created the repo. was unbelievably tough. i had a better experience with jasmine. had equally bad experience with mocha (which is still unfinished). They are other repos of mine if you are interested.Harte
Will definitely take a look. Thanks for your help because your solution was the only one that worked for me!Dorkus

© 2022 - 2024 — McMap. All rights reserved.