Skip to main content

Timeline for Code coverage with Mocha

Current License: CC BY-SA 4.0

23 events
when toggle format what by license comment
S May 9, 2021 at 22:53 history suggested vasilyrud CC BY-SA 4.0
Update link from pointing to deprecated repo of the project, to pointing to the latest website (and documentation) of the project.
May 9, 2021 at 18:18 review Suggested edits
S May 9, 2021 at 22:53
Jan 25, 2021 at 15:55 review Suggested edits
Jan 26, 2021 at 9:07
S Dec 16, 2020 at 3:34 history suggested Rob Paisley CC BY-SA 4.0
Update broken link
Dec 15, 2020 at 14:25 review Suggested edits
S Dec 16, 2020 at 3:34
Sep 24, 2017 at 13:53 history edited Paweł Gościcki CC BY-SA 3.0
Modernize instanbul installation instructions
Jan 12, 2017 at 23:58 history edited jcollum CC BY-SA 3.0
added link to project readme
May 18, 2016 at 3:53 comment added Siva Kandaraj @UlyssesAlves Looks like you are running a windows OS, like @Pier-Luc Gendreau mentioned you will need specify istanbul cover node_modules/mocha/bin/_mocha -- -R spec Source: github.com/gotwarlost/istanbul/issues/90 istanbul assumes that the _mocha you specify translates to a JS file which is true in non-windows environments. In a windows environment, this is likely a batch file that is getting loaded by node and, of course, fails.
Dec 16, 2015 at 18:17 comment added Ulysses Alves It gives me this error: $ istanbul cover _mocha -- -R spec No coverage information was collected, exit without writing coverage information C:\Users\Ulysses\AppData\Roaming\npm\_mocha.CMD:1 (function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0 ^ SyntaxError: Unexpected token ILLEGAL How can I solve this please?
Dec 15, 2015 at 17:53 comment added qbolec Please note that "coverage":"istanbul cover _mocha" in package.json will not work, as it will refer to ./node_modules/.bin/_mocha instead of ./node_modules/mocha/bin/_mocha where first is a shell script and the later is a js
Oct 13, 2015 at 22:24 comment added Kunal Kapadia You can also use npmjs.com/package/gulp-istanbul. It has option to specify npmjs.com/package/isparta as an instrumenter which provides code coverage for ES6.
Mar 11, 2015 at 23:45 comment added Ron E Please note that istanbul actually parses the AST, and therefor if you have comments in your code for various things these will be removed. I spent about 2 hours troubleshooting istanbul only to have to ultimately back out and find a new solution.
Feb 21, 2015 at 17:22 comment added nick One more minor note to make this idiot proof might be the use of "--recursive"
Dec 17, 2014 at 7:42 comment added Pier-Luc Gendreau @ Windows users: istanbul cover node_modules/mocha/bin/_mocha -- -R spec
Nov 13, 2014 at 13:10 comment added Henry Blyth $(npm bin) is a canonical shortcut to ./node_modules/.bin/, and istanbul/lib/cli.js is aliased to istanbul in the bin folder. So here's a shorter command: $(npm bin)/istanbul cover $(npm bin)/_mocha -- --ui bdd -R spec -t 5000
Dec 10, 2013 at 3:38 comment added Dan Kohn @JasonJarrett I highly recommend installing Git Bash (most easily gotten via Github for WIndows). You'll find that most commands run correctly.
Dec 9, 2013 at 22:53 comment added Jason Jarrett I had trouble getting this command to run on windows, but by specifying the full path to the mocha bin I was able to get it to work. istanbul.cmd cover C:\Users\{UserName}\AppData\Roaming\npm\node_modules\mocha\bin\_mocha
Nov 27, 2013 at 19:47 comment added Dan Kohn github.com/daniellmb/grunt-istanbul-coverage or github.com/taichi/grunt-istanbul should work for you. And here is Coffeescript and Istanbul: github.com/Constellation/ibrik
Nov 27, 2013 at 18:35 comment added user238638 has anyone tried this using grunt and coffeescript? I've looked into grunt-mochacov which works fine in linux but not windows (and its using blanket which didnt seem overly functional to me)
May 20, 2013 at 7:53 vote accept tusharmath
May 20, 2013 at 4:49 comment added Dan Kohn Or, install both istanbul and mocha locally, and add the following to the scripts section of your package.json and then just npm run coverage: "coverage": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --ui bdd -R spec -t 5000
May 20, 2013 at 4:45 comment added Eric McCarthy And if you're running a locally installed version of mocha, try istanbul cover node_modules/mocha/bin/_mocha.
May 19, 2013 at 12:51 history answered Dan Kohn CC BY-SA 3.0