Code Monkey home page Code Monkey logo

node-coveralls's Introduction

node-coveralls

Build Status Coverage Status

Coveralls.io support for Node.js. Get the great coverage reporting of coveralls.io and add a cool coverage button (like the one above) to your README.

Supported CI services:

Installation:

Add the latest version of coveralls to your package.json:

npm install coveralls --save-dev

If you're using mocha, add mocha-lcov-reporter to your package.json:

npm install mocha-lcov-reporter --save-dev

Usage:

This script bin/coveralls.js can take standard input from any tool that emits the lcov data format (including mocha's LCOV reporter) and send it to coveralls.io to report your code coverage there.

Once your app is instrumented for coverage, and building, you need to pipe the lcov output to ./node_modules/coveralls/bin/coveralls.js.

This library currently supports Travis CI with no extra effort beyond piping the lcov output to coveralls. However, if you're using a different build system, there are a few necessary environment variables:

  • COVERALLS_SERVICE_NAME (the name of your build system)
  • COVERALLS_REPO_TOKEN (the secret repo token from coveralls.io)
  • COVERALLS_GIT_BRANCH (the branch name)

There are optional environment variables for other build systems as well:

  • COVERALLS_FLAG_NAME (a flag name to differentiate jobs, e.g. Unit, Functional, Integration)
  • COVERALLS_SERVICE_NUMBER (a number that uniquely identifies the build)
  • COVERALLS_SERVICE_JOB_ID (an ID that uniquely identifies the build's job)
  • COVERALLS_SERVICE_JOB_NUMBER (a number that uniquely identifies the build's job)
  • COVERALLS_RUN_AT (a date string for the time that the job ran. RFC 3339 dates work. This defaults to your build system's date/time if you don't set it)
  • COVERALLS_PARALLEL (set to true when running jobs in parallel, requires a completion webhook. More info here: https://docs.coveralls.io/parallel-build-webhook)

GitHub Actions CI

If you are using GitHub Actions CI, you should look into coverallsapp/github-action.

Parallel runs example workflow.yml

Here's our Orb for quick integration: coveralls/coveralls

Workflow example: config.yml

Parallel jobs example: .travis.yml

  • Install jest

  • Use the following to run tests and push files to coveralls on success:

    jest --coverage && coveralls < coverage/lcov.info

Check out an example here which makes use of Travis CI build stages

  • Install blanket.js

  • Configure blanket according to docs.

  • Run your tests with a command like this:

    NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha \
      --require blanket \
      --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js

Instrumenting your app for coverage is probably harder than it needs to be (read here), but that's also a necessary step.

In mocha, if you've got your code instrumented for coverage, the command for a Travis CI build would look something like this:

YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha test -R mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js

Check out an example Makefile from one of my projects for an example, especially the test-coveralls build target. Note: Travis CI runs npm test, so whatever target you create in your Makefile must be the target that npm test runs (This is set in package.json's scripts property).

With Mocha:

istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

With Jasmine:

istanbul cover jasmine-node --captureExceptions spec/ && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

Depend on nodeunit, jscoverage, and coveralls:

npm install nodeunit jscoverage coveralls --save-dev

Add a coveralls script to "scripts" in your package.json:

"scripts": {
  "test": "nodeunit test",
  "coveralls": "jscoverage lib && YOURPACKAGE_COVERAGE=1 nodeunit --reporter=lcov test | coveralls"
}

Ensure your app requires instrumented code when process.env.YOURPACKAGE_COVERAGE variable is defined.

Run your tests with a command like this:

npm run coveralls

For detailed instructions on requiring instrumented code, running on Travis CI and submitting to coveralls see this guide.

Client-side JS code coverage using PhantomJS, Mocha and Blanket:

  • Configure Mocha for browser

  • Mark target script(s) with data-cover HTML attribute

  • Run your tests with a command like this:

    ./node_modules/.bin/poncho -R lcov test/test.html | ./node_modules/coveralls/bin/coveralls.js
lab -r lcov | ./node_modules/.bin/coveralls

Works with almost any testing framework. Simply execute npm test with the nyc bin followed by running its reporter:

nyc npm test && nyc report --reporter=text-lcov | coveralls

Simply run your tap tests with the COVERALLS_REPO_TOKEN environment variable set and tap will automatically use nyc to report coverage to coveralls.

Command Line Parameters

Usage: coveralls.js [-v] filepath

Optional arguments:

  • -v, --verbose
  • filepath - optionally defines the base filepath of your source files.

Running locally

If you're running locally, you must have a .coveralls.yml file, as documented in their documentation, with your repo_token in it; or, you must provide a COVERALLS_REPO_TOKEN environment variable on the command-line.

If you want to send commit data to coveralls, you can set the COVERALLS_GIT_COMMIT environment-variable to the commit hash you wish to reference. If you don't want to use a hash, you can set it to HEAD to supply coveralls with the latest commit data. This requires git to be installed and executable on the current PATH.

Contributing

I generally don't accept pull requests that are untested or break the build, because I'd like to keep the quality high (this is a coverage tool after all!).

I also don't care for "soft-versioning" or "optimistic versioning" (dependencies that have ^, x, > in them, or anything other than numbers and dots). There have been too many problems with bad semantic versioning in dependencies, and I'd rather have a solid library than a bleeding-edge one.

node-coveralls's People

Contributors

addaleax avatar alanshaw avatar anaisbetts avatar cainus avatar dependabot[bot] avatar eagleeye avatar elliottcable avatar fracmak avatar gabehayes avatar geek avatar gerarde avatar honzajavorek avatar ilanbiala avatar jonathanporta avatar mattjmorrison avatar mattkime avatar mdlavin avatar mikaelmello avatar mortonfox avatar nickmerwin avatar ntwb avatar paroga avatar pdehaan avatar rogierslag avatar sgtpooki avatar shinnn avatar swatinem avatar tdd avatar washimimizuku avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-coveralls's Issues

Support for jasmine-node

Does it support jasmine-node?

Currently I'm getting this error

$ jasmine-node --captureExceptions --verbose test/helper.spec.js | ./node_modules/coveralls/bin/coveralls.js
[error] "2013-12-03T18:10:50.327Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2013-12-03T18:10:50.329Z"  'input: ' '\nHelper\n\u001b[32m    should get delta value for \'new\' value\u001b[0m\n\u001b[32m    should get delta value for \'update\' value\u001b[0m\n\u001b[32m    should get delta value for \'delete\' value\u001b[0m\n\nFinished in 0.005 seconds\n\u001b[32m3 tests, 3 assertions, 0 failures, 0 skipped\n\u001b[0m\n\n'
[error] "2013-12-03T18:10:50.329Z"  'error from convertLcovToCoveralls'

/Users/nicola/dev/src/sphere-node-sync/node_modules/coveralls/lib/handleInput.js:17
        throw err;
              ^
Failed to parse string

Thanks

Do not echo all the input

I donโ€™t think there is much value in echoing all the input; it makes the really important output vanish in the noise.
Or maybe if there really is a usecase, please add a -v --verbose option that does so.

Mention nodeunit lcov reporter

This tutorial shows how you can use the lcov nodeunit reporter to submit coverage to coveralls via node-coveralls.

Suggest copy or link to it to increase exposure in the node community :)

running from grunt

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')

CLI get repo_token ?

Some way to enable/sync repo through CLI and then get the repo token for latter use?
Something like Travis CLI

$ travis login --github-token [gh token here]
$ travis enable -r username/reponame

Coveralls CLI

$ coveralls login --github-token [gh token here]
$ coveralls enable -r username/reponame # and output the repo_token?

It does not works in Windows

I have tried to run ./node_modules/coveralls/bin/coveralls.js in Windows and I have got error:

Error: Dynamic Symbol Retrieval Error: "system": The handle is invalid.

I have found description for this error here.

How I can avoid this issue?

Refactor getOptions

Hello,

I have written a wrapper library for node-coveralls called grunt-karma-coveralls which provides glue code between grunt, karma, and node-coveralls. To accomplish this I've used the sendToCoveralls and convertLcovToCoveralls functions. One piece that I'm missing is a majority of the logic inside of getOptions. For grunt-karma-coveralls I would like to be able to reuse the contents of getOptions with the exception of the following block of code:

    // try to get filepath from the command-line
    if (process.argv[2]) {
        if (~['-v', '--verbose'].indexOf(process.argv[2])) {
            if (process.argv[3]) {
                options.filepath = process.argv[3];
            }
        } else {
            options.filepath = process.argv[2];
        }
    }

Would you be willing to extract a method that would be available for me to call that contains all of the logic in getOptions except for the part dealing with process.argv?

Thanks!

Add notes on running tests to `README.md`.

I see that there is a test and that Mocha is a dependency, so I'm assuming that there is some way to run these tests, but the script body for the test script in package.json says make test. I see no Makefile.

Is there unit testing? How do I invoke it?

If not, no big deal. I just don't want to submit a pull request that would break any existing tests.

Bad response 422

I'm having trouble to get coveralls to work with my JS project (ng-caret-aware).

When I exec locally (with repo_token, src_dir and service_name correctly set into my .coveralls.yml file)

cat coverage/report-lcov/lcov.info | ./node_modules/coveralls/bin/coveralls.js

I get

Bad response: 422 {"message":"Couldn't find a repository matching this job.","error":true}

Same happens when previous command is executed from CodeShip CI servers.

Some tips? Is this caused by coveralls.io?

'error from lcovParse: ' 'Failed to parse string'

I'm trying to integrate Coveralls into a library of mine, and am getting a strange error with the Tap integration.

$ npm run coverage

> [email protected] coverage /Users/erunion/code/showtimes
> npm run test | coveralls

[error] "2015-12-19T04:32:35.416Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2015-12-19T04:32:35.418Z"  'input: ' '\n> [email protected] test /Users/erunion/code/showtimes\n> tap test\n\nTAP version 13\n    # Subtest: test/movies.js\n        # Subtest: no movies available for a date far in the future\n        ok 1 - should match pattern provided\n        1..1\n    ok 1 - no movies available for a date far in the future # time=361.088ms\n\n        # Subtest: get theaters from zipcode and get movie for first movie id\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - movie found by id\n        1..3\n    ok 2 - get theaters from zipcode and get movie for first movie id # time=1479.452ms\n\n        # Subtest: get movies from lat/long\n        ok 1 - should be equal\n        ok 2 - more than one movie\n        1..2\n    ok 3 - get movies from lat/long # time=1327.197ms\n\n        # Subtest: get movies from lat/long\n        ok 1 - should be equal\n        ok 2 - more than one movie\n        1..2\n    ok 4 - get movies from lat/long # time=7461.823ms\n\n        # Subtest: get movies from lat/long and get filtered movies for first movie name\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - movies found using query\n        1..3\n    ok 5 - get movies from lat/long and get filtered movies for first movie name # time=4157.36ms\n\n        # Subtest: no movies available for query\n        ok 1 - should be equal\n        1..1\n    ok 6 - no movies available for query # time=272.713ms\n\n        # Subtest: get movies from lat/long and get filtered theaters for first movie name and see if match, they should not.\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - no theaters\n        1..3\n    ok 7 - get movies from lat/long and get filtered theaters for first movie name and see if match, they should not. # time=7742.655ms\n\n    1..7\n    # time=22825.769ms\nok 1 - test/movies.js # time=23221.594ms\n\n    # Subtest: test/theaters.js\n        # Subtest: get theaters from zipcode\n        ok 1 - should be equal\n        ok 2 - more than one theater\n        1..2\n    ok 1 - get theaters from zipcode # time=924.303ms\n\n        # Subtest: get theaters from zipcode and get movie for first movie id\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - movie found by id\n        1..3\n    ok 2 - get theaters from zipcode and get movie for first movie id # time=1078.846ms\n\n        # Subtest: get theaters from lat/long\n        ok 1 - should be equal\n        ok 2 - more than one theater\n        1..2\n    ok 3 - get theaters from lat/long # time=808.958ms\n\n        # Subtest: get theaters from lat/long\n        ok 1 - should be equal\n        ok 2 - more than one theater\n        1..2\n    ok 4 - get theaters from lat/long # time=2965.834ms\n\n        # Subtest: get theaters from lat/long and later get filtered theaters for first theater name\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - theaters found using query\n        1..3\n    ok 5 - get theaters from lat/long and later get filtered theaters for first theater name # time=1523.568ms\n\n        # Subtest: no theaters available for query\n        ok 1 - should be equal\n        1..1\n    ok 6 - no theaters available for query # time=287.796ms\n\n        # Subtest: get theaters from lat/long and get filtered movies for first theaters name and see if match, they should not.\n        ok 1 - should be equal\n        ok 2 - should be equal\n        ok 3 - no movies\n        1..3\n    ok 7 - get theaters from lat/long and get filtered movies for first theaters name and see if match, they should not. # time=5439.293ms\n\n    1..7\n    # time=13055.119ms\nok 2 - test/theaters.js # time=13441.213ms\n\n1..2\n# time=36681.693ms\n'
[error] "2015-12-19T04:32:35.418Z"  'error from convertLcovToCoveralls'

/Users/erunion/code/showtimes/node_modules/coveralls/bin/coveralls.js:18
        throw err;
        ^
Failed to parse string

My scripts list in package.json:

  "scripts": {
    "coverage": "npm run test | coveralls",
    "test": "tap test"
  }

Currently running [email protected], [email protected], and [email protected].

Am I doing something wrong?

Error when commit is signed

An error occurs if a commit is signed eg. with gpg.
I could nail it down to:
fetchGitData.js line 64

response -> example head of a signed commit

tree 146f2ca46b7af35f61b8135851c13f8c16bbcc3d
parent c0df74feed96ab81f010a5ba4ed790366ce4f8a1
author Martin Schaaf <[email protected]> 1409995412 +0200
committer Martin Schaaf <[email protected]> 1409995429 +0200
gpgsig -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org

 iF4EABEIAAYFAlQK0qUACgkQhoqD+KhhN8GwWAD+MZ8tJqGke2ucbbCJNjuB4L1u
 i3zXiVK5wLlA2ZC9IP4A/1lUql8PCrj+UiZfK51vIhhLxsipLW3p0M2Eh2JZRfBi
 =abHb
 -----END PGP SIGNATURE-----

* format
* remove console.log(1)
* add log about successful commit

response.match(REGEX_COMMIT_DETAILS) -> null

response.match(REGEX_COMMIT_DETAILS).slice(1) -> Fatal error: Cannot call method 'slice' of null

Failed to parse string

Hi! I've started seeing errors for an amd build which goes through phantom.js.

[error] "2015-05-10T01:04:18.347Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2015-05-10T01:04:18.351Z"  'input: ' ''
[error] "2015-05-10T01:04:18.353Z"  'error from convertLcovToCoveralls'
/home/travis/.nvm/versions/node/v0.12.2/lib/node_modules/coveralls/bin/coveralls.js:18
        throw err;
              ^
Failed to parse string

Any pointers on what could be the issue?

Error when running coveralls, unable to find logdriver

cat foo.lcov | ./node_modules/.bin/coveralls
fs.js:432
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/home/cainus/logdriver/index.js'
    at Object.fs.openSync (fs.js:432:18)
    at Object.fs.readFileSync (fs.js:289:15)
    at convertLcovFileObject (/Users/joshtombs/Documents/pioneer/node_modules/coveralls/lib/convertLcovToCoveralls.js:18:18)
    at /Users/joshtombs/Documents/pioneer/node_modules/coveralls/lib/convertLcovToCoveralls.js:55:34
    at Array.forEach (native)
    at /Users/joshtombs/Documents/pioneer/node_modules/coveralls/lib/convertLcovToCoveralls.js:54:12
    at walkFile (/Users/joshtombs/Documents/pioneer/node_modules/coveralls/node_modules/lcov-parse/lib/index.js:103:9)
    at /Users/joshtombs/Documents/pioneer/node_modules/coveralls/node_modules/lcov-parse/lib/index.js:112:20
    at Object.cb [as oncomplete] (fs.js:168:19)

BSOD on Windows 7 when trying to push results

I'm getting BSOD of Windows 7 when trying to push results from local machine to coveralls.io. Im using grunt-coveralls, but that one it's just a wrapper and I'm assuming I should write here.

Besides Windows 7, I use git version 1.9.2.msysgit.0, and ruby version 1.9.3p545 (2014-02-24) [i386-mingw32]. With ruby 1.9.3, the BSOD pops some time after the push, and with Ruby 2.1.5, it happen during the grunt task. (I'm not really sure if the Ruby parts matters, but Ruby seems to make some difference).

Config of the grunt task is pretty straightforward too:

coveralls: {
    all: {
        src: "lcov.info",
        force: false
    }
}

And the command to run it is:

grunt coveralls:all

Can you offer some explanation, or point me in a right direction?

Misleading README

While integrating my project with coveralls, I tried following the README, but the instructions are very confusing. The commands listed do not mention to what file they should be added, or what exactly needs to be done.

Most of all, this wording is very confusing:

This library currently supports travis-ci with no extra effort beyond that, but if you're using a different build system, there are a few environment variables that are necessary:

In actuality, you have to edit both your package.json and .travis.yml to make everything work correctly. Restructuring the README to more of a step-by-step guide would be very useful, i.e.:

  1. Install coveralls, mochs, istanbul, etc.
  2. Add a new script to package.json with the test command.
  3. Edit .travis.yml to run the script instead of npm test.

I'd be happy to help rewrite some of it, if you agree.

Branch reporting wrong

Using Git (github) for VCS, Wercker for Build/Deploy and sending coveralls reports from node-coveralls to coveralls.io results in (?) branch data.

Going to have to delve further but perhaps its something I have to set as an environment variable on this CI system to get it to pass correctly?

Project is open source so check it out for any ideas
https://github.com/StevenWeathers/icomoon-style-convert

Error on Travis after update

I've updated to coveralls 2.11.x, using node 0.10.35. On TravisCI I get the error below. All my tests pass, but the coveralls portion makes the build fail.

Build

=============================================================================
Writing coverage object [/home/travis/build/vernak2539/express-less-middleware/coverage/coverage.json]
Writing coverage reports at [/home/travis/build/vernak2539/express-less-middleware/coverage]
=============================================================================
=============================== Coverage summary ===============================
Statements   : 100% ( 74/74 )
Branches     : 93.33% ( 28/30 )
Functions    : 100% ( 17/17 )
Lines        : 100% ( 74/74 )
================================================================================
[error] "2015-03-09T15:40:36.429Z"  'error from getOptions'
/home/travis/build/vernak2539/express-less-middleware/node_modules/coveralls/bin/coveralls.js:18
        throw err;
              ^
Error: Command failed: fatal: Not a valid object name 5460d7ffca633a2769e4b43b38491faf0caed912
    at ChildProcess.exithandler (child_process.js:658:15)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Socket.<anonymous> (child_process.js:979:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

LCOV file generated by intern (using istanbul) uses full filepath - coveralls can't work with that

We started recently with tests (finally ;-)) and use Intern for it. Intern generates lcov files using istanbul and the SF has the full path with it, e.g. (when building on travis): /home/travis/candy/...

Now coveralls tries to get this file from our repo which doesn't work for obvious reasons.
According to theintern/intern#229, passing the full path is required by the LCOV file specs, therefore it would be awesome if we could somehow specify something to be stripped off of each file path before sending it to coveralls.

Do you have an idea how this could be achieved in an easy way?

response.match(REGEX_COMMIT_DETAILS) is null in fetchGitData.js

https://travis-ci.org/paazmaya/naginata.fi/builds/15591863#L2253

This occurred ins 2.5.0 and in 2.6.0.
It seems that the latest successful report was made 5 days ago.

The output from the above test run:

/home/travis/build/paazmaya/naginata.fi/node_modules/coveralls/lib/fetchGitData.js:69

var items = response.match(REGEX_COMMIT_DETAILS).slice(1);

^

TypeError: Cannot call method 'slice' of null

at /home/travis/build/paazmaya/naginata.fi/node_modules/coveralls/lib/fetchGitData.js:69:54

at ChildProcess.exithandler (child_process.js:635:7)

at ChildProcess.EventEmitter.emit (events.js:98:17)

at maybeClose (child_process.js:735:16)

at Socket.<anonymous> (child_process.js:948:11)

at Socket.EventEmitter.emit (events.js:95:17)

at Pipe.close (net.js:466:12)

Update README with command line params

I was having an issue where node-coveralls was assuming the filepath in the LCOV report is relative to the current working directory. This was causing a file not found exception in lib/ConvertLcovToCoveralls.js. Looking through the node-coveralls code, I figured out that I could specify the base file path as a command line argument. [1]

Could you please document this in the README? I am not sure which other command line params are supported, otherwise I would submit a PR. ;)

[1] https://github.com/cainus/node-coveralls/blob/master/lib/getOptions.js#L109

cat: ./coverage/lcov.info: No such file or directory

Hi,
when running
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

I'm getting "No such file or directory" for ./coverage/lcov.info"

  Array
    #indexOf()
      โœ“ should return -1 when the value is not present


  1 passing (5ms)

No coverage information was collected, exit without writing coverage information
cat: ./coverage/lcov.info: No such file or directory

istanbul is installed and running.

Please assist,
Thanks.

TravisCI - 'Repo token could not be determined'

I don't know what can cause this at travis, but this happens from time to time:
https://travis-ci.org/polvo/polvo-css/builds/10862402#L354

Wouldn't it be appropriate to suggest users to encrypt their repo tokens within the .travis.yml file?

The docs:
http://about.travis-ci.org/docs/user/encryption-keys/
http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables

Very simple usage:

gem install travis travis-lint
travis encrypt COVERALLS_REPO_TOKEN=$TOKEN --add -r $USERNAME/$REPO
travis-lint .travis.yml

You should see a message like:

Hooray, /Users/username/path/to/repo/.travis.yml seems to be solid!

"Coverage unknown" after successful build & upload

I have a simple A/B test repo I put together for AngularJS
https://github.com/daniellmb/ab-test-service

I have travis building and am using an encrypted coveralls repo token (has 100% coverage)
https://travis-ci.org/daniellmb/ab-test-service/builds/20585438

no errors, but coveralls says the coverage is still unknown
https://coveralls.io/jobs/1384617

I just heard about coveralls yesterday and thought I'd try it, so I'm not sure I missed something, or if I typically takes a very long time to show up properly. Thoughts?

Errors even though test passes

I get an error after all my tests pass.

I'm using Mocha and Istanbul.

[error] "2014-04-09T02:14:05.808Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2014-04-09T02:14:05.810Z"  'input: ' ''
[error] "2014-04-09T02:14:05.811Z"  'error from convertLcovToCoveralls'
node_modules/coveralls/bin/coveralls.js:18
        throw err;
              ^
Failed to parse string
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

This is my test statement by the way:

NODE_ENV=test istanbul cover mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js

Any thoughts?

Arguments to path.resolve must be strings

I'm having trouble getting this to work. Here's the error I get:

path.js:439
      throw new TypeError('Arguments to path.resolve must be strings');
      ^
TypeError: Arguments to path.resolve must be strings
    at Object.posix.resolve (path.js:439:13)
    at convertLcovFileObject (/Users/dshowers/Development/generator-wp-simple/node_modules/coveralls/lib/convertLcovToCoveralls.js:18:19)
    at /Users/dshowers/Development/generator-wp-simple/node_modules/coveralls/lib/convertLcovToCoveralls.js:61:34
    at Array.forEach (native)
    at /Users/dshowers/Development/generator-wp-simple/node_modules/coveralls/lib/convertLcovToCoveralls.js:60:12
    at walkFile (/Users/dshowers/Development/generator-wp-simple/node_modules/coveralls/node_modules/lcov-parse/lib/index.js:111:9)
    at /Users/dshowers/Development/generator-wp-simple/node_modules/coveralls/node_modules/lcov-parse/lib/index.js:120:20
    at FSReqWrap.cb [as oncomplete] (fs.js:226:19)

I spent some time trying to figure out what is happening and from what I can tell, file is undefined on line 17 of convertLcovToCoveralls.js. The cause is a character in the input file (\u001b[?25HSF) that is keeping the file property from getting set on the first file object.

This is what I have in my package.json:

mocha --require blanket --reporter mocha-lcov-reporter test | ./node_modules/coveralls/bin/coveralls.js

Failure on git commits that lack email

TypeError: Cannot read property 'slice' of null
    at node_modules/coveralls/lib/fetchGitData.js:69:53
    at ChildProcess.exithandler (child_process.js:742:7)
    at ChildProcess.emit (events.js:110:17)

All commit messages are "unknown"

Our Coveralls integration with HipChat is working except for log messages. They always say "Unknown Commit Message". The Coveralls team said:


Hi Geoff, this looks like a problem with the coveralls library you're using -- node-coveralls I assume? It may be the integration with CircleCI that's at fault here:

https://github.com/cainus/node-coveralls/blob/master/lib/getOptions.js#L37

We don't officially support this library so you may want to open an issue with them.

Hope that helps, thanks!

Please advise, thanks.
-G

pipe the lcov output

Once your app is instrumented for coverage, and building, you need to pipe the lcov output to ./node_modules/coveralls/bin/coveralls.js.

Would be awesome if you could share an example.

trying to debug why handleInput isn't working on Travis

https://travis-ci.org/pocesar/js-chain-commander/jobs/18185530

I'm trying to debug why coveralls.io isn't receiving the report. the node-coveralls debug seems to be stopping before "getBaseOptions" (the callback isn't getting called, thus never getting "done"). Instead of calling it from the command line, I'm passing the content of the lcov file directly to handleInput (as you can see inside Gruntfile.js).

  grunt.event.on('coverage', function(data){
    process.env.NODE_COVERALLS_DEBUG = 1;
    grunt.log.writeln('Travis JOB ID:', process.env.TRAVIS_JOB_ID);
    grunt.log.writeln('Travis ENV:', process.env.TRAVIS);

    var coveralls = require('coveralls');

    coveralls.handleInput(data, function(err){
      if (err) {
        throw err;
      }
    });
  });

The env are correct, but handleInput is "stopping" for unknown reasons, since it's not debugging anything else past the log.debug(input). Not sure what else I can try to make it spit more information why it's not sending any coverage information ( https://coveralls.io/r/pocesar/js-chain-commander )

EDIT: seems fetchGitData is the culprit, it's not calling the cb() but for unknown reasons

EDIT2: require('child_process').exec isn't liking the args passed at "once" with spaces, better to use spawn with the args array, it's stopping at exec("git rev-parse --verify " + git.head.id).

Invalid reporter

Hi,

I'm trying to use Coverballs with Instanbul and Moch as detailed here.

The command they give is:

istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage

Since I've written my tests in a test directory and not specI just changed that. Still, it's not working and I don't get why, it seems to come from the reporter:

istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R test/**/*-test.js && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
=============================================================================
Writing coverage object [/path/to/project/coverage/coverage.json]
Writing coverage reports at [/path/to/project/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 34.98% ( 78/223 )
Branches     : 1.49% ( 1/67 )
Functions    : 13.04% ( 9/69 )
Lines        : 34.98% ( 78/223 )
================================================================================
/path/to/project/node_modules/mocha/lib/mocha.js:149
    if (!_reporter) throw new Error('invalid reporter "' + reporter + '"');
                          ^
Error: invalid reporter "test/middleware/dbf-upload-test.js"
    at Mocha.reporter (/path/to/project/node_modules/mocha/lib/mocha.js:149:27)
    at Object.<anonymous> (/path/to/project/node_modules/mocha/bin/_mocha:214:7)
    at Module._compile (module.js:460:26)
    at Module._extensions..js (module.js:478:10)
    at Object.Module._extensions..js (/usr/local/lib/node_modules/istanbul/lib/hook.js:102:13)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at runFn (/usr/local/lib/node_modules/istanbul/lib/command/common/run-with-cover.js:116:16)
    at /usr/local/lib/node_modules/istanbul/lib/command/common/run-with-cover.js:241:17
    at /usr/local/lib/node_modules/istanbul/lib/util/file-matcher.js:68:16
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:254:17
    at done (/usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:135:19)
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:32:16
    at /usr/local/lib/node_modules/istanbul/node_modules/async/lib/async.js:251:21
    at LOOP (fs.js:1478:14)
    at process._tickCallback (node.js:355:11)

Show coverage for multiple node versions

travis CI will run my tests in multiple different node versions.

Is there a way to send the node version to coveralls so that I get seperate coverage reports for seperate node versions ?

done ENV commented out

Was curious why you have commented out the done env variables in the getOptions.js file

Coveralls task listed as "pending"

On this Pull Request: hammerlab/pileup.js#152

The "coveralls" task has been listed as pending for the past several hours:

screen shot 2015-05-19 at 4 57 13 pm

If you look at the build, you can see that valid LCOV data is being generated (it's all logged) and information is being sent to coveralls. Coveralls, however, just shows a blank page.

The only warning I see is this:

[warn] "2015-05-19T19:31:18.507Z" 'Repo token could not be determined. Continuing without it.This is necessary for private repos only, so may not be an issue at all.'

which seems innocuous enough. I'm using node-coveralls 2.10 instead of 2.11 because of #80.

Any ideas? Since my LCOV data looks reasonable and Coverall's status page shows nothing wrong, I'm assuming the problem is in the node-coveralls step.

Specifically ignore methods

Hello,
Is there a way to specifically flag a method to be ignored during the check and the calculation of the coverage score ?

Add ability to prevent logging to stdout

In most cases logging warnings to stdout is desired, I am using node-coveralls programmatically and would like to maintain control of stdout, as well as generate my own warnings.

Currently, we want to prevent reports when there is no COVERALLS_REPO_TOKEN set. This scenario causes mixed messages, as node-coveralls logs "[warn] "date" 'Repo token could not be determined. Continuing without it.'" and then we throw an error.

Tests can fail and end up writing to another .git folder

Last night I set to work trying to make a tiny pull request (Hide repo warning when running in Travis) and ended up spending a long time trying to solve a problem created when the tests edited my ~/.git folder.

At some point I think the following happened:

  • A test failed and ended up leaving my ~/src/node-coveralls/.git moved off to ~/src/.node-coveralls/.git.bak without moving it back.
  • Running the tests again ended up removing the trailing newline character in my ~/.git/HEAD file.

It turns out having a ~/.git/HEAD without a newline doesn't break basic git commands, but breaks the git-prompt.sh functions (__git_ps1) so after doing this none of my terminals had my git branch showing. I ended up spending a long time trying to figure out what broke my git branch from showing up ๐Ÿ‘Ž

I'm sorry that I'm opening an issue without a pull-request but I just wanted to alert that this could happen and suggest that all tests create it's own git root in a sub directory so you don't have to just recurse to find it. Currently some of the git tests can fail when a user is trying to use git commands while running the tests. When tests fail you can leave your own (or other non-related) git directories in strange states ๐Ÿ˜ข

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.