istanbul-lib-instrument
Advanced tools
Comparing version 3.3.0 to 4.0.0-alpha.0
@@ -6,2 +6,18 @@ # Change Log | ||
# [4.0.0-alpha.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.3.0...istanbul-lib-instrument@4.0.0-alpha.0) (2019-06-19) | ||
### Features | ||
* Update dependencies, require Node.js 8 ([#401](https://github.com/istanbuljs/istanbuljs/issues/401)) ([bf3a539](https://github.com/istanbuljs/istanbuljs/commit/bf3a539)) | ||
### BREAKING CHANGES | ||
* Node.js 8 is now required | ||
# [3.3.0](https://github.com/istanbuljs/istanbuljs/compare/istanbul-lib-instrument@3.2.0...istanbul-lib-instrument@3.3.0) (2019-04-24) | ||
@@ -8,0 +24,0 @@ |
@@ -9,3 +9,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function get() { | ||
get: function () { | ||
return _instrumenter.defaultOpts; | ||
@@ -16,3 +16,3 @@ } | ||
enumerable: true, | ||
get: function get() { | ||
get: function () { | ||
return _visitor.default; | ||
@@ -23,3 +23,3 @@ } | ||
enumerable: true, | ||
get: function get() { | ||
get: function () { | ||
return _readCoverage.default; | ||
@@ -26,0 +26,0 @@ } |
@@ -67,4 +67,6 @@ "use strict"; | ||
class Instrumenter { | ||
constructor(opts = defaultOpts()) { | ||
this.opts = this.normalizeOpts(opts); | ||
constructor(opts = {}) { | ||
this.opts = { ...defaultOpts(), | ||
...opts | ||
}; | ||
this.fileCoverage = null; | ||
@@ -74,22 +76,2 @@ this.sourceMap = null; | ||
/** | ||
* normalize options passed in and assign defaults. | ||
* @param opts | ||
* @private | ||
*/ | ||
normalizeOpts(opts) { | ||
const normalize = (name, defaultValue) => { | ||
if (!opts.hasOwnProperty(name)) { | ||
opts[name] = defaultValue; | ||
} | ||
}; | ||
const defOpts = defaultOpts(); | ||
Object.keys(defOpts).forEach(k => { | ||
normalize(k, defOpts[k]); | ||
}); | ||
return opts; | ||
} | ||
/** | ||
* instrument the supplied code and track coverage against the supplied | ||
@@ -96,0 +78,0 @@ * filename. It throws if invalid code is passed to it. ES5 and ES6 syntax |
@@ -38,3 +38,5 @@ "use strict"; | ||
ObjectProperty(path) { | ||
const node = path.node; | ||
const { | ||
node | ||
} = path; | ||
@@ -61,4 +63,3 @@ if (!node.computed && t.isIdentifier(node.key) && node.key.name === _constants.MAGIC_KEY) { | ||
for (var _i = 0, _arr = ['path', 'hash', 'gcv', 'coverageData']; _i < _arr.length; _i++) { | ||
const key = _arr[_i]; | ||
for (const key of ['path', 'hash', 'gcv', 'coverageData']) { | ||
const binding = covScope.getOwnBinding(key); | ||
@@ -65,0 +66,0 @@ |
@@ -311,3 +311,3 @@ "use strict"; | ||
// the enter function | ||
const wrappedEntry = function wrappedEntry(path, node) { | ||
const wrappedEntry = function (path, node) { | ||
this.onEnter(path); | ||
@@ -324,3 +324,3 @@ | ||
const exit = function exit(path, node) { | ||
const exit = function (path, node) { | ||
this.onExit(path, node); | ||
@@ -601,3 +601,6 @@ }; | ||
opts = Object.assign({}, (0, _instrumenter.defaultOpts)(), defaultProgramVisitorOpts, opts); | ||
opts = { ...(0, _instrumenter.defaultOpts)(), | ||
...defaultProgramVisitorOpts, | ||
...opts | ||
}; | ||
const visitState = new VisitState(types, sourceFilePath, opts.inputSourceMap, opts.ignoreClassMethods); | ||
@@ -604,0 +607,0 @@ return { |
{ | ||
"name": "istanbul-lib-instrument", | ||
"version": "3.3.0", | ||
"version": "4.0.0-alpha.0", | ||
"description": "Core istanbul API for JS code coverage", | ||
@@ -12,14 +12,28 @@ "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", | ||
"release": "babel src --out-dir dist && documentation build -f md -o api.md src", | ||
"test": "mocha --require=@babel/register", | ||
"test": "nyc --nycrc-path=../../monorepo-per-package-nycrc.json --require=@babel/register --include=src mocha", | ||
"prepublish": "npm run release" | ||
}, | ||
"dependencies": { | ||
"@babel/generator": "^7.4.0", | ||
"@babel/parser": "^7.4.3", | ||
"@babel/template": "^7.4.0", | ||
"@babel/traverse": "^7.4.3", | ||
"@babel/types": "^7.4.0", | ||
"istanbul-lib-coverage": "^2.0.5", | ||
"semver": "^6.0.0" | ||
"@babel/generator": "^7.4.4", | ||
"@babel/parser": "^7.4.5", | ||
"@babel/template": "^7.4.4", | ||
"@babel/traverse": "^7.4.5", | ||
"@babel/types": "^7.4.4", | ||
"istanbul-lib-coverage": "^3.0.0-alpha.0", | ||
"semver": "^6.1.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.4.4", | ||
"@babel/core": "^7.4.5", | ||
"@babel/plugin-transform-modules-commonjs": "^7.4.4", | ||
"@babel/register": "^7.4.4", | ||
"chai": "^4.2.0", | ||
"clone": "^2.1.2", | ||
"debug": "^4.1.1", | ||
"documentation": "^11.0.1", | ||
"js-yaml": "^3.13.1", | ||
"mocha": "^6.1.4", | ||
"nopt": "^4.0.1", | ||
"nyc": "^14.1.1" | ||
}, | ||
"license": "BSD-3-Clause", | ||
@@ -41,5 +55,5 @@ "bugs": { | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
"gitHead": "90e60cc47833bb780680f916488ca24f0be36ca2" | ||
"gitHead": "2e885073a9398806c9b8763dd39418398182ca34" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
55561
12
913
1
+ Addedistanbul-lib-coverage@3.2.2(transitive)
- Removedistanbul-lib-coverage@2.0.5(transitive)
Updated@babel/generator@^7.4.4
Updated@babel/parser@^7.4.5
Updated@babel/template@^7.4.4
Updated@babel/traverse@^7.4.5
Updated@babel/types@^7.4.4
Updatedsemver@^6.1.1