Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running from grunt #24

Closed
laurelnaiad opened this issue Sep 23, 2013 · 1 comment
Closed

running from grunt #24

laurelnaiad opened this issue Sep 23, 2013 · 1 comment

Comments

@laurelnaiad
Copy link

I've set up my grunt process to run node-coveralls. Thought I might share a code snippet that let me stay within grunt when calling coveralls.js. I'm using grunt-mocha-test to run my tests and coverage, and I use captureFile: 'test/coverage.log' from the mocha-lcov-reporter. I set this up because I couldn't figure out how to configure grunt-mocha-test to pipe the coverage data to coveralls.js. Thought it might help someone or perhaps there was an easier way and I didn't discover it!

Yes, it's coffeescript -- translation to js is left as an exercise :)

  # send coverage info to coveralls
  grunt.registerTask 'cov-to-coveralls',
      'Run node-coveralls with an lcov file',
      () ->

        lcovLogPath = 'test/coverage.log'
        coverallsPath = './node_modules/coveralls/bin/coveralls.js'

        coveralls = require('child_process').spawn coverallsPath,
            [],
            stdio: ['pipe', process.stdout, process.stderr]
        done = @async()
        coveralls.on 'exit', (code) ->
          done(code == 0)
        coveralls.stdin.end require('fs').readFileSync(lcovLogPath , 'utf8')
@cainus
Copy link
Collaborator

cainus commented Sep 23, 2013

Thanks! https://github.com/mattjmorrison/grunt-karma-coveralls/blob/master/tasks/main.js might be a good example as well. I'll close this issue now too, unless there's actually a problem that I missed.

@cainus cainus closed this as completed Sep 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants