istanbul-lib-instrument
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [3.1.1](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.1.0...istanbul-lib-instrument@3.1.1) (2019-03-12) | ||
### Bug Fixes | ||
* Honor istanbul ignore next hints placed before export statement. ([#298](https://github.com/istanbuljs/istanbuljs/issues/298)) ([f24795d](https://github.com/istanbuljs/istanbuljs/commit/f24795d)), closes [#297](https://github.com/istanbuljs/istanbuljs/issues/297) | ||
# [3.1.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.0.1...istanbul-lib-instrument@3.1.0) (2019-01-26) | ||
@@ -8,0 +19,0 @@ |
@@ -8,2 +8,4 @@ "use strict"; | ||
var _crypto = require("crypto"); | ||
var _semver = require("semver"); | ||
@@ -13,4 +15,2 @@ | ||
var _crypto = require("crypto"); | ||
// function to use for creating hashes | ||
@@ -17,0 +17,0 @@ const SHA = 'sha1'; // name of coverage data magic key |
@@ -84,3 +84,3 @@ "use strict"; | ||
const defOpts = defaultOpts(); | ||
Object.keys(defOpts).forEach(function (k) { | ||
Object.keys(defOpts).forEach(k => { | ||
normalize(k, defOpts[k]); | ||
@@ -122,3 +122,3 @@ }); | ||
ignoreClassMethods: opts.ignoreClassMethods, | ||
inputSourceMap: inputSourceMap | ||
inputSourceMap | ||
}); | ||
@@ -129,5 +129,7 @@ let output = {}; | ||
enter: ee.enter, | ||
exit: function exit(path) { | ||
exit(path) { | ||
output = ee.exit(path); | ||
} | ||
} | ||
@@ -174,3 +176,3 @@ }; | ||
try { | ||
var out = this.instrumentSync(code, filename, inputSourceMap); | ||
const out = this.instrumentSync(code, filename, inputSourceMap); | ||
callback(null, out); | ||
@@ -177,0 +179,0 @@ } catch (ex) { |
@@ -8,4 +8,2 @@ "use strict"; | ||
var _constants = require("./constants"); | ||
var _parser = require("@babel/parser"); | ||
@@ -17,2 +15,4 @@ | ||
var _constants = require("./constants"); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } | ||
@@ -37,3 +37,3 @@ | ||
(0, _traverse.default)(ast, { | ||
ObjectProperty: function ObjectProperty(path) { | ||
ObjectProperty(path) { | ||
const node = path.node; | ||
@@ -52,2 +52,3 @@ | ||
} | ||
}); | ||
@@ -54,0 +55,0 @@ |
@@ -47,3 +47,3 @@ "use strict"; | ||
newStatement(loc) { | ||
var s = this.meta.last.s; | ||
const s = this.meta.last.s; | ||
this.data.statementMap[s] = cloneLocation(loc); | ||
@@ -56,6 +56,6 @@ this.data.s[s] = 0; | ||
newFunction(name, decl, loc) { | ||
var f = this.meta.last.f; | ||
const f = this.meta.last.f; | ||
name = name || '(anonymous_' + f + ')'; | ||
this.data.fnMap[f] = { | ||
name: name, | ||
name, | ||
decl: cloneLocation(decl), | ||
@@ -72,7 +72,7 @@ loc: cloneLocation(loc), | ||
newBranch(type, loc) { | ||
var b = this.meta.last.b; | ||
const b = this.meta.last.b; | ||
this.data.b[b] = []; | ||
this.data.branchMap[b] = { | ||
loc: cloneLocation(loc), | ||
type: type, | ||
type, | ||
locations: [], | ||
@@ -87,4 +87,4 @@ // DEPRECATED: some legacy reports require this info. | ||
addBranchPath(name, location) { | ||
var bMeta = this.data.branchMap[name], | ||
counts = this.data.b[name]; | ||
const bMeta = this.data.branchMap[name]; | ||
const counts = this.data.b[name]; | ||
/* istanbul ignore if: paranoid check */ | ||
@@ -113,5 +113,5 @@ | ||
// prune empty branches | ||
var map = this.data.branchMap, | ||
branches = this.data.b; | ||
Object.keys(map).forEach(function (b) { | ||
const map = this.data.branchMap; | ||
const branches = this.data.b; | ||
Object.keys(map).forEach(b => { | ||
if (map[b].locations.length === 0) { | ||
@@ -118,0 +118,0 @@ delete map[b]; |
@@ -8,2 +8,6 @@ "use strict"; | ||
var _crypto = require("crypto"); | ||
var _template = _interopRequireDefault(require("@babel/template")); | ||
var _sourceCoverage = require("./source-coverage"); | ||
@@ -13,6 +17,2 @@ | ||
var _crypto = require("crypto"); | ||
var _template = _interopRequireDefault(require("@babel/template")); | ||
var _instrumenter = require("./instrumenter"); | ||
@@ -30,3 +30,3 @@ | ||
function genVar(filename) { | ||
var hash = (0, _crypto.createHash)(_constants.SHA); | ||
const hash = (0, _crypto.createHash)(_constants.SHA); | ||
hash.update(filename); | ||
@@ -65,3 +65,3 @@ return 'cov_' + parseInt(hash.digest('hex').substr(0, 12), 16).toString(36); | ||
if (node.leadingComments) { | ||
node.leadingComments.forEach(function (c) { | ||
node.leadingComments.forEach(c => { | ||
const v = (c.value || | ||
@@ -83,4 +83,2 @@ /* istanbul ignore next: paranoid check */ | ||
maybeAssignSourceMapURL(node) { | ||
const that = this; | ||
const extractURL = comments => { | ||
@@ -91,3 +89,3 @@ if (!comments) { | ||
comments.forEach(function (c) { | ||
comments.forEach(c => { | ||
const v = (c.value || | ||
@@ -99,3 +97,3 @@ /* istanbul ignore next: paranoid check */ | ||
if (groups) { | ||
that.sourceMappingURL = groups[1]; | ||
this.sourceMappingURL = groups[1]; | ||
} | ||
@@ -300,5 +298,5 @@ }); | ||
accumulator.push({ | ||
node: node, | ||
parent: parent, | ||
property: property | ||
node, | ||
parent, | ||
property | ||
}); | ||
@@ -319,5 +317,4 @@ } | ||
function entries() { | ||
const enter = Array.prototype.slice.call(arguments); // the enter function | ||
function entries(...enter) { | ||
// the enter function | ||
const wrappedEntry = function wrappedEntry(path, node) { | ||
@@ -330,5 +327,4 @@ this.onEnter(path); | ||
const that = this; | ||
enter.forEach(function (e) { | ||
e.call(that, path, node); | ||
enter.forEach(e => { | ||
e.call(this, path, node); | ||
}); | ||
@@ -343,3 +339,3 @@ }; | ||
enter: wrappedEntry, | ||
exit: exit | ||
exit | ||
}; | ||
@@ -388,3 +384,3 @@ } | ||
function makeParenthesizedExpressionForNonIdentifier(path) { | ||
var T = this.types; | ||
const T = this.types; | ||
@@ -423,7 +419,7 @@ if (path.node && !path.isIdentifier()) { | ||
function coverIfBranches(path) { | ||
const n = path.node, | ||
hint = this.hintFor(n), | ||
ignoreIf = hint === 'if', | ||
ignoreElse = hint === 'else', | ||
branch = this.cov.newBranch('if', n.loc); | ||
const n = path.node; | ||
const hint = this.hintFor(n); | ||
const ignoreIf = hint === 'if'; | ||
const ignoreElse = hint === 'else'; | ||
const branch = this.cov.newBranch('if', n.loc); | ||
@@ -462,6 +458,6 @@ if (ignoreIf) { | ||
function coverTernary(path) { | ||
const n = path.node, | ||
branch = this.cov.newBranch('cond-expr', path.node.loc), | ||
cHint = this.hintFor(n.consequent), | ||
aHint = this.hintFor(n.alternate); | ||
const n = path.node; | ||
const branch = this.cov.newBranch('cond-expr', path.node.loc); | ||
const cHint = this.hintFor(n.consequent); | ||
const aHint = this.hintFor(n.alternate); | ||
@@ -484,3 +480,3 @@ if (cHint !== 'next') { | ||
let leaves = []; | ||
const leaves = []; | ||
this.findLeaves(path.node, leaves); | ||
@@ -512,2 +508,6 @@ const b = this.cov.newBranch('binary-expr', path.node.loc); | ||
// ignore processing only | ||
ExportDefaultDeclaration: entries(), | ||
// ignore processing only | ||
ExportNamedDeclaration: entries(), | ||
// ignore processing only | ||
ClassMethod: entries(coverFunction), | ||
@@ -514,0 +514,0 @@ ClassDeclaration: entries(parenthesizedExpressionProp('superClass')), |
{ | ||
"name": "istanbul-lib-instrument", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Core istanbul API for JS code coverage", | ||
@@ -21,3 +21,3 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", | ||
"@babel/types": "^7.0.0", | ||
"istanbul-lib-coverage": "^2.0.3", | ||
"istanbul-lib-coverage": "^2.0.4", | ||
"semver": "^5.5.0" | ||
@@ -29,3 +29,3 @@ }, | ||
}, | ||
"homepage": "https://github.com/istanbuljs/istanbuljs", | ||
"homepage": "https://istanbul.js.org/", | ||
"repository": { | ||
@@ -44,3 +44,3 @@ "type": "git", | ||
}, | ||
"gitHead": "7875defdc3c3640787ac5d83700246de119e8b83" | ||
"gitHead": "c81b051d83217947dfd97d8d06532bd5013e98c3" | ||
} |
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
53227
907
+ Added@babel/code-frame@7.24.7(transitive)
+ Added@babel/generator@7.25.6(transitive)
+ Added@babel/helper-string-parser@7.24.8(transitive)
+ Added@babel/helper-validator-identifier@7.24.7(transitive)
+ Added@babel/highlight@7.24.7(transitive)
+ Added@babel/parser@7.25.6(transitive)
+ Added@babel/template@7.25.0(transitive)
+ Added@babel/traverse@7.25.6(transitive)
+ Added@babel/types@7.25.6(transitive)
+ Addedjsesc@2.5.2(transitive)
- Removed@babel/code-frame@7.25.7(transitive)
- Removed@babel/generator@7.25.7(transitive)
- Removed@babel/helper-string-parser@7.25.7(transitive)
- Removed@babel/helper-validator-identifier@7.25.7(transitive)
- Removed@babel/highlight@7.25.7(transitive)
- Removed@babel/parser@7.25.7(transitive)
- Removed@babel/template@7.25.7(transitive)
- Removed@babel/traverse@7.25.7(transitive)
- Removed@babel/types@7.25.7(transitive)
- Removedjsesc@3.0.2(transitive)
Updatedistanbul-lib-coverage@^2.0.4