Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

istanbul

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istanbul - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

5

lib/cli.js

@@ -9,7 +9,4 @@ #!/usr/bin/env node

var path = require('path'),
Command = require('./command'),
var Command = require('./command'),
inputError = require('./util/input-error'),
Store = require('./store'),
Report = require('./report'),
exit = process.exit; //hold a reference to original process.exit so that we are not affected even when a test changes it

@@ -16,0 +13,0 @@

2

lib/collector.js

@@ -65,3 +65,3 @@ /*

*/
add: function (coverage, testName) {
add: function (coverage /*, testName */) {
var store = this.store;

@@ -68,0 +68,0 @@ Object.keys(coverage).forEach(function (key) {

@@ -6,3 +6,2 @@ /*

/*jslint nomen: true */
var Factory = require('../util/factory'),

@@ -9,0 +8,0 @@ factory = new Factory('command', __dirname, true);

@@ -81,7 +81,10 @@ /*

usage: function () {
console.error('\nUsage: ' + this.toolName() + ' ' + this.type() + ' <options> <file-or-directory>\n\nOptions are:\n\n'
+ [
formatOption('--output <file-or-dir>', 'The output file or directory. This is required when the input is a directory, defaults to standard output when input is a file'),
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns (e.g. "**/vendor/**" to ignore all files under a vendor directory). Also see the --default-excludes option'),
formatOption('--variable <global-coverage-variable-name>', 'change the variable name of the global coverage variable from the default value of `__coverage__` to something else'),
console.error('\nUsage: ' + this.toolName() + ' ' + this.type() + ' <options> <file-or-directory>\n\nOptions are:\n\n' +
[
formatOption('--output <file-or-dir>', 'The output file or directory. This is required when the input is a directory, ' +
'defaults to standard output when input is a file'),
formatOption('-x <exclude-pattern> [-x <exclude-pattern>]', 'one or more fileset patterns (e.g. "**/vendor/**" to ignore all files ' +
'under a vendor directory). Also see the --default-excludes option'),
formatOption('--variable <global-coverage-variable-name>', 'change the variable name of the global coverage variable from the ' +
'default value of `__coverage__` to something else'),
formatOption('--embed-source', 'embed source code into the coverage object, defaults to false'),

@@ -88,0 +91,0 @@ formatOption('--[no-]compact', 'produce [non]compact output, defaults to compact')

@@ -30,4 +30,4 @@ /*

usage: function () {
console.error('\nUsage: ' + this.toolName() + ' ' + this.type() + ' <options> [ <format> [<include-pattern>] ]\n\nOptions are:\n\n'
+ [
console.error('\nUsage: ' + this.toolName() + ' ' + this.type() + ' <options> [ <format> [<include-pattern>] ]\n\nOptions are:\n\n' +
[
formatOption('--root <input-directory>', 'The input root directory for finding coverage files'),

@@ -41,3 +41,4 @@ formatOption('--dir <report-directory>', 'The output directory where files will be written. This defaults to ./coverage/'),

console.error('<format> is one of html, lcovonly or lcov (html + lcovonly). Default is lcov');
console.error('<include-pattern> is a fileset pattern that can be used to select one or move coverage files for merged reporting. This defaults to "**/coverage*.json"');
console.error('<include-pattern> is a fileset pattern that can be used to select one or move coverage files ' +
'for merged reporting. This defaults to "**/coverage*.json"');

@@ -44,0 +45,0 @@ console.error('\n');

@@ -33,5 +33,3 @@ /*

*/
/*jslint nomen: true */
var path = require('path'),
fs = require('fs'),
var fs = require('fs'),
Module = require('module'),

@@ -94,4 +92,4 @@ vm = require('vm'),

var fn = transformFn(matcher, transformer, options.verbose),
postLoadHook = options.postLoadHook
&& typeof options.postLoadHook === 'function' ? options.postLoadHook : null;
postLoadHook = options.postLoadHook &&
typeof options.postLoadHook === 'function' ? options.postLoadHook : null;

@@ -98,0 +96,0 @@ Module._extensions['.js'] = function (module, filename) {

@@ -51,3 +51,2 @@ /*

} else {
/*jslint nomen: true */
window.__cov_seq = window.__cov_seq || 0;

@@ -142,3 +141,4 @@ window.__cov_seq += 1;

children = SYNTAX[type].children,
applyCustomWalker = !!node.loc || node.type === SYNTAX.Program.name, // don't run generated nodes thru custom walks otherwise we will attempt to instrument the instrumentation code :)
// don't run generated nodes thru custom walks otherwise we will attempt to instrument the instrumentation code :)
applyCustomWalker = !!node.loc || node.type === SYNTAX.Program.name,
walkerFn = applyCustomWalker ? walker.walkMap[type] : null,

@@ -153,3 +153,2 @@ i,

childElement,
tmpNode,
pathElement,

@@ -165,3 +164,5 @@ assignNode,

ret = walker.walk(ret, walkerFn[walkFnIndex]) || ret;
if (ret.type !== type && !isLast) { throw new Error('Only the last walker is allowed to change the node type: [type was: ' + type + ' ]'); }
if (ret.type !== type && !isLast) {
throw new Error('Only the last walker is allowed to change the node type: [type was: ' + type + ' ]');
}
}

@@ -377,3 +378,4 @@ } else {

if (typeof code !== 'string') { throw new Error('Code must be string'); } //protect from users accidentally passing in a Buffer object instead
//protect from users accidentally passing in a Buffer object instead
if (typeof code !== 'string') { throw new Error('Code must be string'); }
if (code.charAt(0) === '#') { //shebang, 'comment' it out, won't affect syntax tree locations for things we care about

@@ -385,3 +387,3 @@ code = '//' + code;

}
program = ESP.parse(code, { loc: true, range: true, comment: true });
program = ESP.parse(code, { loc: true });
if (!this.opts.noAutoWrap) {

@@ -460,3 +462,5 @@ program = { type: SYNTAX.Program.name, body: program.body[0].expression.callee.body.body };

coverState,
replacer = function (s) { //return replacements using the function to ensure that the replacement is treated like a dumb string and not as a string with RE replacement patterns
// return replacements using the function to ensure that the replacement is
// treated like a dumb string and not as a string with RE replacement patterns
replacer = function (s) {
return function () { return s; };

@@ -514,3 +518,3 @@ },

skipInit: function (node, walker) {
skipInit: function (node /*, walker */) {
if (node.init) {

@@ -521,3 +525,3 @@ node.init.skipWalk = true;

skipLeft: function (node, walker) {
skipLeft: function (node /*, walker */) {
node.left.skipWalk = true;

@@ -558,3 +562,6 @@ },

coverFunction: function (node, walker) {
var id = this.functionName(node, walker.startLineForNode(node), { start: node.loc.start, end: { line: node.body.loc.start.line, column: node.body.loc.start.column } }),
var id = this.functionName(node, walker.startLineForNode(node), {
start: node.loc.start,
end: { line: node.body.loc.start.line, column: node.body.loc.start.column }
}),
body = node.body,

@@ -664,3 +671,6 @@ blockBody = body.body;

this.findLeaves(node, leaves);
bName = this.branchName('binary-expr', walker.startLineForNode(node), this.locationsForNodes(leaves.map(function (item) { return item.node; })));
bName = this.branchName('binary-expr',
walker.startLineForNode(node),
this.locationsForNodes(leaves.map(function (item) { return item.node; }))
);
for (i = 0; i < leaves.length; i += 1) {

@@ -667,0 +677,0 @@ tuple = leaves[i];

@@ -6,3 +6,3 @@ /*

/*jslint nomen: true */
/*jshint maxlen: 300 */
var handlebars = require('handlebars'),

@@ -69,3 +69,2 @@ path = require('path'),

].join('\n'),
seq = 0,
lt = '\u0001',

@@ -89,4 +88,4 @@ gt = '\u0002',

rest = 100 - num;
return '<span class="cover-fill' + cls + '" style="width: ' + num + 'px;"></span>'
+ '<span class="cover-empty" style="width:' + rest + 'px;"></span>';
return '<span class="cover-fill' + cls + '" style="width: ' + num + 'px;"></span>' +
'<span class="cover-empty" style="width:' + rest + 'px;"></span>';
} else {

@@ -98,10 +97,10 @@ return '';

handlebars.registerHelper('show_lines', function (opts) {
var maxLines = Number(opts.fn(this)),
i,
array = [];
var maxLines = Number(opts.fn(this)),
i,
array = [];
for (i = 0; i < maxLines; i += 1) {
array[i] = i + 1;
}
return array.join('\n');
for (i = 0; i < maxLines; i += 1) {
array[i] = i + 1;
}
return array.join('\n');
});

@@ -135,3 +134,12 @@

handlebars.registerHelper('show_code', function (context, opts) {
function customEscape(text) {
text = text.toString();
return text.replace(RE_AMP, '&amp;')
.replace(RE_LT, '&lt;')
.replace(RE_GT, '&gt;')
.replace(RE_lt, '<')
.replace(RE_gt, '>');
}
handlebars.registerHelper('show_code', function (context /*, opts */) {
var structured = context,

@@ -279,11 +287,2 @@ array = [];

function customEscape(text) {
text = text.toString();
return text.replace(RE_AMP, '&amp;')
.replace(RE_LT, '&lt;')
.replace(RE_GT, '&gt;')
.replace(RE_lt, '<')
.replace(RE_gt, '>');
}
function getReportClass(stats) {

@@ -338,8 +337,8 @@ var coveragePct = stats.pct,

for (i = 0; i < nodePath.length; i += 1) {
linkPath.push('<a href="' + linkMapper.ancestor(node, i + 1) + '">'
+ (nodePath[i].relativeName || 'All files') + '</a>');
linkPath.push('<a href="' + linkMapper.ancestor(node, i + 1) + '">' +
(nodePath[i].relativeName || 'All files') + '</a>');
}
linkPath.reverse();
return linkPath.length > 0 ? linkPath.join(' &#187; ') + ' &#187; '
+ node.displayShortName() : '';
return linkPath.length > 0 ? linkPath.join(' &#187; ') + ' &#187; ' +
node.displayShortName() : '';
},

@@ -355,3 +354,2 @@

structured = code.map(function (str) { count += 1; return { line: count, covered: null, text: new InsertionText(str, true) }; }),
lineNum = 0,
context;

@@ -358,0 +356,0 @@

@@ -6,3 +6,2 @@ /*

/*jslint nomen: true */
var Factory = require('../util/factory'),

@@ -28,3 +27,3 @@ factory = new Factory('report', __dirname, false);

*/
function Report(options) {}
function Report(/* options */) {}
//add register, create, mix, loadAll, getStoreList as class methods

@@ -56,3 +55,3 @@ factory.bindClassMethods(Report);

*/
writeReport: function (collector, sync) {
writeReport: function (/* collector, sync */) {
throw new Error('writeReport: must be overridden');

@@ -59,0 +58,0 @@ }

@@ -8,3 +8,2 @@ /*

mkdirp = require('mkdirp'),
util = require('util'),
Report = require('./index'),

@@ -28,3 +27,4 @@ LcovOnlyReport = require('./lcovonly'),

* @param {Object} opts optional
* @param {String} [opts.dir] the directory in which to the `lcov.info` file. HTML files are written in a subdirectory called `lcov-report`. Defaults to `process.cwd()`
* @param {String} [opts.dir] the directory in which to the `lcov.info` file.
* HTML files are written in a subdirectory called `lcov-report`. Defaults to `process.cwd()`
*/

@@ -31,0 +31,0 @@ function LcovReport(opts) {

@@ -7,9 +7,5 @@ /*

var path = require('path'),
fs = require('fs'),
Writer = require('../util/file-writer'),
util = require('util'),
Report = require('./index'),
Store = require('../store'),
Writer = require('../util/file-writer'),
utils = require('../object-utils');
Report = require('./index');
/**

@@ -16,0 +12,0 @@ * a `Report` implementation that produces an LCOV coverage file from coverage objects.

@@ -6,4 +6,3 @@ /*

var util = require('util'),
Report = require('./index');
var Report = require('./index');

@@ -17,3 +16,3 @@ function NoneReport() {

Report.mix(NoneReport, {
writeReport: function (collector, sync) {
writeReport: function (/* collector, sync */) {
//noop

@@ -20,0 +19,0 @@ }

@@ -9,3 +9,2 @@ /*

fs = require('fs'),
util = require('util'),
utils = require('../object-utils'),

@@ -46,3 +45,3 @@ Report = require('./index');

Report.mix(TextSummaryReport, {
writeReport: function (collector, sync) {
writeReport: function (collector /*, sync */) {
var summaries = [],

@@ -49,0 +48,0 @@ finalSummary,

@@ -9,3 +9,2 @@ /*

fs = require('fs'),
util = require('util'),
Report = require('./index'),

@@ -64,10 +63,10 @@ TreeSummarizer = require('../util/tree-summarizer'),

fmtStr = '',
fill;
fillStr;
if (remaining > 0) {
if (remaining >= str.length) {
fill = padding(remaining - str.length);
fmtStr = right ? fill + str : str + fill;
fillStr = padding(remaining - str.length);
fmtStr = right ? fillStr + str : str + fillStr;
} else {
fmtStr = str.substring(str.length - remaining);
fmtStr = str.substring(str.length - remaining);
fmtStr = '... ' + fmtStr.substring(4);

@@ -166,3 +165,3 @@ }

Report.mix(TextReport, {
writeReport: function (collector, sync) {
writeReport: function (collector /*, sync */) {
var summarizer = new TreeSummarizer(),

@@ -169,0 +168,0 @@ tree,

@@ -50,3 +50,3 @@ /*

},
set: function (key, contents) {
set: function (key /*, contents */) {
if (!this.hasKey(key)) {

@@ -53,0 +53,0 @@ throw new Error('Attempt to set contents for non-existent file [' + key + '] on a fslookup store');

@@ -6,3 +6,2 @@ /*

/*jslint nomen: true */
var Factory = require('../util/factory'),

@@ -43,3 +42,3 @@ factory = new Factory('store', __dirname, false);

*/
function Store(options) {}
function Store(/* options */) {}

@@ -75,3 +74,3 @@ //add register, create, mix, loadAll, getStoreList as class methods

*/
set: function (key, contents) { throw new Error("set: must be overridden"); },
set: function (/* key, contents */) { throw new Error("set: must be overridden"); },
/**

@@ -84,3 +83,3 @@ * returns the content associated to a specific key or throws if the key

*/
get: function (key) { throw new Error("get: must be overridden"); },
get: function (/* key */) { throw new Error("get: must be overridden"); },
/**

@@ -98,3 +97,3 @@ * returns a list of all known keys

*/
hasKey: function (key) { throw new Error("hasKey: must be overridden"); },
hasKey: function (/* key */) { throw new Error("hasKey: must be overridden"); },
/**

@@ -101,0 +100,0 @@ * lifecycle method to dispose temporary resources associated with the store

@@ -5,3 +5,2 @@ /*

*/
/*jslint nomen: true */
var path = require('path'),

@@ -8,0 +7,0 @@ fs = require('fs'),

@@ -157,4 +157,3 @@ /*

calculateMetrics: function (entry) {
var that = this,
metrics = null;
var that = this;
if (entry.kind !== 'dir') {return; }

@@ -161,0 +160,0 @@ entry.children.forEach(function (child) {

@@ -6,3 +6,2 @@ /*

/*jslint nomen:true */
//EXPERIMENTAL code: do not rely on this in anyway until the docs say it is allowed

@@ -9,0 +8,0 @@

{
"name": "istanbul",
"version": "0.1.12",
"version": "0.1.13",
"description": "Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale",

@@ -15,2 +15,3 @@ "keywords": "coverage,code coverage, JS code coverage, JS coverage",

"scripts": {
"pretest": "jshint --config ./node_modules/yui-lint/jshint.json lib/*js lib/command/*js lib/report/*js lib/store/*js lib/util/*js",
"test": "test/run.js",

@@ -36,3 +37,5 @@ "docs": "npm install yuidocjs && node node_modules/yuidocjs/lib/cli.js ."

"rimraf": "*",
"nodeunit": "*"
"nodeunit": "*",
"jshint": "*",
"yui-lint": "*"
},

@@ -39,0 +42,0 @@ "TODO": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc