New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

semicov

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semicov - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

35

index.js

@@ -7,3 +7,3 @@ var Module = require('module');

filename = filename.replace(/\\/g, '\\\\');
if (!~filename.indexOf(addCoverage.subdir)) {
if (!eligibleForCoverage(filename)) {
return code;

@@ -17,3 +17,7 @@ }

if (lines.length > 0) {
lines[0] = 'if (!__cov["' + filename + '"]) {__cov["' + filename + '"] = { 0: 1}; }' + lines[0];
if (lines[0].match(/use strict/)) {
lines[0] = lines[0] + ' if (!__cov["' + filename + '"]) {__cov["' + filename + '"] = { 0: 1}; }';
} else {
lines[0] = 'if (!__cov["' + filename + '"]) {__cov["' + filename + '"] = { 0: 1}; }' + lines[0];
}
}

@@ -33,2 +37,15 @@

var eligibleForCoverage = exports.eligibleForCoverage = function (filename) {
var p = exports.addCoverage.paths;
if (typeof p === 'string') {
return ~filename.indexOf(p);
} else if (p instanceof RegExp) {
return filename.match(p);
} else if (p instanceof Array) {
return p.some(function(x) {
return !!~filename.indexOf(x);
});
}
};
var projectName;

@@ -41,7 +58,13 @@

subdir = process.cwd();
} else if (!subdir.match(/^\//)) {
subdir = path.join(process.cwd(), subdir);
} else if (typeof subdir === 'string') {
if (!subdir.match(/^\//)) {
subdir = path.join(process.cwd(), subdir);
}
} else if (subdir instanceof Array) {
subdir = subdir.map(function(x) {
return x.match(/^\//) ? x : path.join(process.cwd(), x);
});
}
global.__cov = {};
exports.addCoverage.subdir = subdir;
exports.addCoverage.paths = subdir;
var compile = Module.prototype._compile;

@@ -53,3 +76,3 @@ Object.keys(Module._cache).forEach(function (path) {

Module.prototype._compile = function (code, filename) {
if (~filename.indexOf(subdir)) {
if (eligibleForCoverage(filename)) {
code = exports.addCoverage(code, filename);

@@ -56,0 +79,0 @@ }

{
"author": "Anatoliy Chakkaev <rpm1602@gmail.com>",
"name": "semicov",
"version": "0.1.1",
"version": "0.2.0",
"main": "index.js",

@@ -9,2 +9,6 @@ "dependencies": {},

"optionalDependencies": {},
"repository": {
"type": "git",
"url": "git://github.com/1602/semicov"
},
"engines": {

@@ -11,0 +15,0 @@ "node": "*"

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