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

grunt-istanbul

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-istanbul - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

.travis.yml

1

Gruntfile.js

@@ -40,2 +40,3 @@ module.exports = function(grunt) {

options : {
lazy : true,
basePath : 'build/instrument/'

@@ -42,0 +43,0 @@ }

12

package.json
{
"name": "grunt-istanbul",
"description": "JavaScript codecoverage tool for Grunt",
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://github.com/taichi/grunt-istanbul",

@@ -11,2 +11,6 @@ "author": {

},
"contributors": [
"Matthew Andrews <matthew@andrews.eu.com>",
"Ryan Miller <rmiller@marinsoftware.com>"
],
"repository": {

@@ -25,6 +29,6 @@ "type": "git",

],
"main": "grunt.js",
"main": "Gruntfile.js",
"bin": "bin/grunt-istanbul",
"engines": {
"node": ">= 0.10.0"
"node": ">= 0.8.0"
},

@@ -35,3 +39,3 @@ "scripts": {

"dependencies": {
"istanbul" : "~0.1.31",
"istanbul" : "~0.1.43",
"nue": "0.7.0dev"

@@ -38,0 +42,0 @@ },

@@ -1,2 +0,2 @@

# grunt-istanbul
# grunt-istanbul [![Build Status](https://travis-ci.org/taichi/grunt-istanbul.png)](https://travis-ci.org/taichi/grunt-istanbul)

@@ -8,5 +8,5 @@ JavaScript codecoverage tool for Grunt

Install this grunt plugin next to your project's [grunt.js gruntfile][getting_started] with: `npm install grunt-istanbul`
Install this grunt plugin next to your project's [Gruntfile.js][getting_started] with: `npm install grunt-istanbul`
Then add this line to your project's `grunt.js` gruntfile:
Then add this line to your project's `Gruntfile.js` gruntfile:

@@ -21,3 +21,3 @@ ```javascript

## Documentation
_(Coming soon)_
see [Gruntfile.js](https://github.com/taichi/grunt-istanbul/blob/master/Gruntfile.js#69)

@@ -24,0 +24,0 @@ ## Contributing

@@ -20,3 +20,3 @@ exports.init = function(grunt) {

}
function makeReporters(options) {

@@ -40,3 +40,3 @@ var result = [];

append(options.type);
var mapping = {

@@ -58,26 +58,51 @@ 'none' : [],

instrument : function(files, options, done) {
var instFlow = flow(function readFile(file) {
fs.readFile(file, 'utf8', this.async({
name : file,
code : as(1)
}));
}, function instrument(f) {
grunt.verbose.writeln('instrument from ' + f.name);
var instrumenter = new istanbul.Instrumenter(options);
instrumenter.instrument(f.code, f.name, this.async({
name : f.name,
code : as(1)
}));
}, function write(result) {
var out = path.join(options.basePath, options.flatten === true ? path
.basename(result.name) : result.name);
grunt.verbose.writeln('instrument to ' + out);
grunt.file.mkdir(path.dirname(out));
fs.writeFile(out, result.code, 'utf8', this.async(as(1)));
}, function end() {
flowEnd(this.err, this.next.bind(this));
});
var outFile = function(file) {
return path.join(options.basePath, options.flatten === true ? path.basename(file) : file);
};
var instFlow = flow(function readFile(f) {
fs.readFile(f.name, 'utf8', this.async({
name : f.name,
code : as(1)
}));
}, function instrument(f) {
grunt.verbose.writeln('instrument from ' + f.name);
var instrumenter = new istanbul.Instrumenter(options);
instrumenter.instrument(f.code, f.name, this.async({
name : f.name,
code : as(1)
}));
}, function write(result) {
var out = outFile(result.name);
grunt.verbose.writeln('instrument to ' + out);
grunt.file.mkdir(path.dirname(out));
fs.writeFile(out, result.code, 'utf8', this.async(as(1)));
}, function end() {
flowEnd(this.err, this.next.bind(this));
});
var dateCheckFlow = flow(function checkDestExists(f) {
grunt.verbose.writeln('checking destination exists ' + f.name);
fs.exists(outFile(f.name), this.async({ name : f.name, exists : as(0) }));
},
function readStat(f) {
if (f.exists) {
grunt.verbose.writeln('reading stat for ' + f.name);
fs.stat(f.name, this.async({ name : f.name, stat : as(1) }));
fs.stat(outFile(f.name), this.async({ name : f.name, stat : as(1) }));
} else {
grunt.verbose.writeln('instrumented file does not exist ' + f.name);
this.end({ name : f.name, instrument : true });
}
}, function decision(i, o) {
var reinstrument = i.stat.mtime.getTime() > o.stat.mtime.getTime();
grunt.verbose.writeln('make a decision about instrumenting ' + i.name + ': ' + reinstrument);
this.end({ name: i.name, instrument: reinstrument });
}, function end(f) {
if (f.instrument) this.exec(instFlow, { name : f.name }, this.async());
});
flow(function(filelist) {
this.asyncEach(filelist, function(file, group) {
this.exec(instFlow, file, group.async(as(1)));
this.exec((options.lazy ? dateCheckFlow : instFlow), { name : file }, group.async(as(1)));
});

@@ -84,0 +109,0 @@ }, done)(files);

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