Comparing version 0.2.10 to 0.2.11
@@ -6,2 +6,5 @@ Changelog | ||
<tr> | ||
<td>v0.2.11</td><td>Allow source map generation, thanks to @jason0x43</td> | ||
</tr> | ||
<tr> | ||
<td>v0.2.10</td><td>Add flag to handle sigints and dump coverage, thanks to @samccone</td> | ||
@@ -8,0 +11,0 @@ </tr> |
@@ -469,4 +469,9 @@ /* | ||
var usingStrict = false, | ||
codegenOptions; | ||
codegenOptions, | ||
generated, | ||
preamble, | ||
lineCount, | ||
i; | ||
filename = filename || String(new Date().getTime()) + '.js'; | ||
this.sourceMap = null; | ||
this.coverState = { | ||
@@ -502,3 +507,17 @@ path: filename, | ||
//console.log(JSON.stringify(program, undefined, 2)); | ||
return this.getPreamble(originalCode || '', usingStrict) + '\n' + ESPGEN.generate(program, codegenOptions) + '\n'; | ||
generated = ESPGEN.generate(program, codegenOptions); | ||
preamble = this.getPreamble(originalCode || '', usingStrict); | ||
if (generated.map && generated.code) { | ||
lineCount = preamble.split(/\r\n|\r|\n/).length; | ||
// offset all the generated line numbers by the number of lines in the preamble | ||
for (i = 0; i < generated.map._mappings.length; i += 1) { | ||
generated.map._mappings[i].generatedLine += lineCount; | ||
} | ||
this.sourceMap = generated.map; | ||
generated = generated.code; | ||
} | ||
return preamble + '\n' + generated + '\n'; | ||
}, | ||
@@ -542,2 +561,11 @@ /** | ||
}, | ||
/** | ||
* returns the source map object for the code that was instrumented | ||
* just before calling this method. | ||
* @return {Object} a source map object for the code last instrumented | ||
* by this instrumenter | ||
*/ | ||
lastSourceMap: function () { | ||
return this.sourceMap; | ||
}, | ||
fixColumnPositions: function (coverState) { | ||
@@ -544,0 +572,0 @@ var offset = LEADER_WRAP.length, |
{ | ||
"name": "istanbul", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"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", | ||
@@ -33,3 +33,4 @@ "keywords": [ "coverage", "code coverage", "JS code coverage", "JS coverage" ], | ||
"@markyen", | ||
"Sam Saccone @samccone <sam@samx.it>" | ||
"Sam Saccone @samccone <sam@samx.it>", | ||
"Jason Cheatham @jason0x43" | ||
], | ||
@@ -36,0 +37,0 @@ "preferGlobal": true, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
255385
5177