Socket
Socket
Sign inDemoInstall

coffee-coverage

Package Overview
Dependencies
9
Maintainers
12
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 2.0.0

docs/HOWTO-nyc.md

6

CHANGELOG.md
# coffee-coverage Changelog
### v2.0.0
- Add support for [nyc](https://github.com/istanbuljs/nyc).
### v1.0.2
- [#78: Update dependencies; Walk Arrays of case statements](https://github.com/benbria/coffee-coverage/pull/78)
### v1.0.0

@@ -4,0 +10,0 @@ - [#71: Accept globs as excludes](https://github.com/benbria/coffee-coverage/pull/71) Many thanks to

11

lib/coffeeCoverage.js

@@ -283,3 +283,3 @@ // Generated by CoffeeScript 1.10.0

return function(visitor, nodeWrapper) {
var i, indent, name, ref3, ref4;
var __, i, indent, j, len, name, ref3, ref4, ref5;
if ((ref3 = nodeWrapper.node.coffeeCoverage) != null ? ref3.generated : void 0) {

@@ -307,2 +307,11 @@ return;

}
if (nodeWrapper.isSwitchCases) {
ref5 = nodeWrapper.node;
for (i = j = 0, len = ref5.length; j < len; i = ++j) {
__ = ref5[i];
nodeWrapper.forEachChildOfType(i, function(child) {
return runVisitor(visitor, child);
});
}
}
return nodeWrapper.forEachChild(function(child) {

@@ -309,0 +318,0 @@ return runVisitor(visitor, child);

68

lib/instrumentors/Istanbul.js

@@ -69,3 +69,3 @@ // Generated by CoffeeScript 1.10.0

return {
coverageVar: (ref1 = module.exports.findIstanbulVariable()) != null ? ref1 : '_$coffeeIstanbul'
coverageVar: (ref1 = module.exports.findIstanbulVariable()) != null ? ref1 : '__coverage__'
};

@@ -220,2 +220,3 @@ };

line: ifLocation.start.line,
loc: ifLocation,
type: 'if',

@@ -227,3 +228,3 @@ locations: [ifLocation, elseLocation]

Istanbul.prototype.visitSwitch = function(node) {
var branchId, locations;
var branchId, loc, locations;
if (node.isMarked('noCoverage')) {

@@ -269,4 +270,6 @@ return;

}
loc = nodeToLocation(node);
this.branchMap.push({
line: nodeToLocation(node).start.line,
line: loc.start.line,
loc: loc,
type: 'switch',

@@ -295,3 +298,3 @@ locations: locations

Istanbul.prototype.visitCode = function(node) {
var arrow, end, endOfFn, fnMapEntry, functionId, isAssign, lastParam, loc, name, paramCount, ref1, ref2, ref3, ref4, ref5, start;
var arrow, end, endOfFn, fnMapEntry, functionId, isAssign, lastParam, name, paramCount, ref1, ref2, ref3, ref4, ref5, start;
if (node.isMarked('noCoverage')) {

@@ -332,10 +335,10 @@ return;

}
loc = {
start: start,
end: end
};
fnMapEntry = {
name: name,
line: start.line,
loc: loc
loc: nodeToLocation(node),
decl: {
start: start,
end: end
}
};

@@ -364,3 +367,4 @@ if ((ref5 = node.node.coffeeCoverage) != null ? ref5.skip : void 0) {

line: loc.start.line,
loc: loc
loc: nodeToLocation(node),
decl: loc
});

@@ -381,27 +385,21 @@ return node.insertAtStart('body', this._prefix + ".f[" + functionId + "]++");

};
this.statementMap.forEach((function(_this) {
return function(statement, id) {
initData.s[id + 1] = 0;
return initData.statementMap[id + 1] = statement;
};
})(this));
this.branchMap.forEach((function(_this) {
return function(branch, id) {
initData.b[id + 1] = (function() {
var i, ref1, results;
results = [];
for (i = 0, ref1 = branch.locations.length; 0 <= ref1 ? i < ref1 : i > ref1; 0 <= ref1 ? i++ : i--) {
results.push(0);
}
return results;
})();
return initData.branchMap[id + 1] = branch;
};
})(this));
this.fnMap.forEach((function(_this) {
return function(fn, id) {
initData.f[id + 1] = 0;
return initData.fnMap[id + 1] = fn;
};
})(this));
this.statementMap.forEach(function(statement, id) {
initData.s[id + 1] = 0;
return initData.statementMap[id + 1] = statement;
});
this.branchMap.forEach(function(branch, id) {
initData.b[id + 1] = (function() {
var i, ref1, results;
results = [];
for (i = 0, ref1 = branch.locations.length; 0 <= ref1 ? i < ref1 : i > ref1; 0 <= ref1 ? i++ : i--) {
results.push(0);
}
return results;
})();
return initData.branchMap[id + 1] = branch;
});
this.fnMap.forEach(function(fn, id) {
initData.f[id + 1] = 0;
return initData.fnMap[id + 1] = fn;
});
return init = "if (typeof " + this.coverageVar + " === 'undefined') " + this.coverageVar + " = {};\n(function(_export) {\n if (typeof _export." + this.coverageVar + " === 'undefined') {\n _export." + this.coverageVar + " = " + this.coverageVar + ";\n }\n})(typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this);\nif (! " + this._prefix + ") { " + this._prefix + " = " + (JSON.stringify(initData)) + " }";

@@ -408,0 +406,0 @@ };

@@ -26,2 +26,3 @@ // Generated by CoffeeScript 1.10.0

}
this.isSwitchCases = this.childName === 'cases' && this.type === 'Array';
}

@@ -185,4 +186,5 @@

if (this.node.locationData != null) {
return answer += " (" + (((ref = this.node.locationData) != null ? ref.first_line : void 0) + 1) + ":" + (this.node.locationData.first_column + 1) + ")";
answer += " (" + (((ref = this.node.locationData) != null ? ref.first_line : void 0) + 1) + ":" + (this.node.locationData.first_column + 1) + ")";
}
return answer;
};

@@ -189,0 +191,0 @@

@@ -15,3 +15,3 @@ {

],
"version": "1.0.1",
"version": "2.0.0",
"author": "Benbria (http://www.benbria.com/)",

@@ -28,8 +28,3 @@ "contributors": [

],
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/benbria/coffee-coverage/master/LICENSE"
}
],
"license": "MIT",
"main": "./lib/index",

@@ -49,4 +44,4 @@ "repository": {

"coffee-script": ">=1.6.2",
"lodash": "^3.7.0",
"minimatch": "^3.0.0",
"lodash": "^4.14.0",
"minimatch": "^3.0.2",
"pkginfo": ">=0.2.3"

@@ -57,7 +52,7 @@ },

"coveralls": "^2.11.2",
"istanbul": "^0.3.13",
"istanbul": "^0.4.4",
"mocha": "^2.1.0",
"sinon": "^1.14.1",
"benchmark": "^2.0.0",
"streamline": "^0.12.1"
"streamline": "0.12.1"
},

@@ -64,0 +59,0 @@ "scripts": {

@@ -20,2 +20,3 @@ Istanbul and JSCoverage-style instrumentation for CoffeeScript files.

* Conditional instrumentation with [pragmas](./docs/pragmas.md)
* Support for [nyc](./docs/HOWTO-nyc.md) style instrumentation
* Support for [Istanbul](./docs/HOWTO-istanbul.md) style instrumentation

@@ -22,0 +23,0 @@ * Support for [JSCoverage](./docs/HOWTO-jscoverage.md) style instrumentation

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc