coffee-coverage
Advanced tools
Comparing version 0.6.3 to 0.7.0
# coffee-coverage Changelog | ||
### v0.7.0 | ||
- [#64: Add `postProcessors` option to `register()`](https://github.com/benbria/coffee-coverage/pull/64) and deprecate `streamlinejs` option. | ||
### v0.5.3 | ||
@@ -4,0 +7,0 @@ - [#42: Fix the 0% coverage for files that are never loaded](https://github.com/benbria/coffee-coverage/pull/42) |
@@ -31,3 +31,3 @@ // Generated by CoffeeScript 1.9.2 | ||
module.exports = function(options) { | ||
var compiledCache, coverage, defaults, instrumentFile, instrumentorClass, module, origStreamineCoffeeHandler, replaceHandler, streamlineTransform; | ||
var compiledCache, coverage, defaults, err, instrumentFile, instrumentorClass, module, origStreamineCoffeeHandler, replaceHandler, streamlineTransform; | ||
if (options == null) { | ||
@@ -44,2 +44,3 @@ options = {}; | ||
streamlinejs: false, | ||
postProcessors: [], | ||
cachePath: null | ||
@@ -93,3 +94,9 @@ }); | ||
if (options.streamlinejs) { | ||
streamlineTransform = require('streamline/lib/callbacks/transform'); | ||
console.warn("\noptions.streamlinejs is deprecated. Please use options.postProcessors\n"); | ||
try { | ||
streamlineTransform = require('streamline/lib/callbacks/transform'); | ||
} catch (_error) { | ||
err = _error; | ||
throw new Error("Could not load streamline transformer < 1.x"); | ||
} | ||
origStreamineCoffeeHandler = require.extensions["._coffee"]; | ||
@@ -114,5 +121,32 @@ require.extensions["._coffee"] = function(module, fileName) { | ||
} | ||
if (_.isArray(options.postProcessors) && options.postProcessors.length) { | ||
options.postProcessors.forEach(function(processorOpts) { | ||
var ext, fn, originalHandler; | ||
if (processorOpts == null) { | ||
processorOpts = {}; | ||
} | ||
ext = processorOpts.ext, fn = processorOpts.fn; | ||
if (!(_.isString(ext) && _.isFunction(fn))) { | ||
return; | ||
} else if ("._coffee" === ext && options.streamlinejs) { | ||
return; | ||
} | ||
originalHandler = require.extensions[ext]; | ||
return require.extensions[ext] = function(module, fileName) { | ||
var processed; | ||
if (excludeFile(fileName, options)) { | ||
return originalHandler.call(this, module, fileName); | ||
} | ||
processed = compiledCache.get(fileName, function() { | ||
var compiled; | ||
compiled = instrumentFile(fileName); | ||
return fn(compiled, fileName); | ||
}); | ||
return module._compile(processed, fileName); | ||
}; | ||
}); | ||
} | ||
if (options.writeOnExit) { | ||
return process.on('exit', function() { | ||
var dirName, err, ref1; | ||
var dirName, ref1; | ||
try { | ||
@@ -119,0 +153,0 @@ dirName = path.dirname(options.writeOnExit); |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"author": "Benbria (http://www.benbria.com/)", | ||
@@ -56,3 +56,4 @@ "contributors": [ | ||
"mocha": "^2.1.0", | ||
"sinon": "^1.14.1" | ||
"sinon": "^1.14.1", | ||
"streamline": "^0.12.1" | ||
}, | ||
@@ -59,0 +60,0 @@ "scripts": { |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
109428
42
1868
11
6