diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/istanbul-lib-instrument | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) | |
download | wallet-core-7a3df06eb573d36142bd1a8e03c5ce8752d300b3.tar.xz |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/istanbul-lib-instrument')
-rw-r--r-- | node_modules/istanbul-lib-instrument/CHANGELOG.md | 11 | ||||
-rw-r--r-- | node_modules/istanbul-lib-instrument/dist/visitor.js | 14 | ||||
-rw-r--r-- | node_modules/istanbul-lib-instrument/package.json | 7 |
3 files changed, 30 insertions, 2 deletions
diff --git a/node_modules/istanbul-lib-instrument/CHANGELOG.md b/node_modules/istanbul-lib-instrument/CHANGELOG.md index d1c32d8a1..925db8493 100644 --- a/node_modules/istanbul-lib-instrument/CHANGELOG.md +++ b/node_modules/istanbul-lib-instrument/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +<a name="1.7.1"></a> +## [1.7.1](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.7.0...istanbul-lib-instrument@1.7.1) (2017-04-29) + + +### Bug Fixes + +* don't instrument a file if it has already been instrumented ([#38](https://github.com/istanbuljs/istanbuljs/issues/38)) ([9c38e4e](https://github.com/istanbuljs/istanbul-lib-instrument/commit/9c38e4e)) + + + + <a name="1.7.0"></a> # [1.7.0](https://github.com/istanbuljs/istanbul-lib-instrument/compare/istanbul-lib-instrument@1.6.2...istanbul-lib-instrument@1.7.0) (2017-03-27) diff --git a/node_modules/istanbul-lib-instrument/dist/visitor.js b/node_modules/istanbul-lib-instrument/dist/visitor.js index 518b1e31e..beae5d91b 100644 --- a/node_modules/istanbul-lib-instrument/dist/visitor.js +++ b/node_modules/istanbul-lib-instrument/dist/visitor.js @@ -482,6 +482,14 @@ var codeVisitor = { }; // the template to insert at the top of the program. var coverageTemplate = (0, _babelTemplate2.default)('\n var COVERAGE_VAR = (function () {\n var path = PATH,\n hash = HASH,\n global = (new Function(\'return this\'))(),\n gcv = GLOBAL_COVERAGE_VAR,\n coverageData = INITIAL,\n coverage = global[gcv] || (global[gcv] = {});\n if (coverage[path] && coverage[path].hash === hash) {\n return coverage[path];\n }\n coverageData.hash = hash;\n return coverage[path] = coverageData;\n })();\n'); +// the rewire plugin (and potentially other babel middleware) +// may cause files to be instrumented twice, see: +// https://github.com/istanbuljs/babel-plugin-istanbul/issues/94 +// we should only instrument code for coverage the first time +// it's run through istanbul-lib-instrument. +function alreadyInstrumented(path, visitState) { + return path.scope.hasBinding(visitState.varName); +} /** * programVisitor is a `babel` adaptor for instrumentation. * It returns an object with two methods `enter` and `exit`. @@ -510,9 +518,15 @@ function programVisitor(types) { var visitState = new VisitState(types, sourceFilePath, opts.inputSourceMap); return { enter: function enter(path) { + if (alreadyInstrumented(path, visitState)) { + return; + } path.traverse(codeVisitor, visitState); }, exit: function exit(path) { + if (alreadyInstrumented(path, visitState)) { + return; + } visitState.cov.freeze(); var coverageData = visitState.cov.toJSON(); coverageData[_constants.MAGIC_KEY] = _constants.MAGIC_VALUE; diff --git a/node_modules/istanbul-lib-instrument/package.json b/node_modules/istanbul-lib-instrument/package.json index 48cf66cb4..7a8083475 100644 --- a/node_modules/istanbul-lib-instrument/package.json +++ b/node_modules/istanbul-lib-instrument/package.json @@ -1,9 +1,12 @@ { "name": "istanbul-lib-instrument", - "version": "1.7.0", + "version": "1.7.1", "description": "Core istanbul API for JS code coverage", "author": "Krishnan Anantheswaran <kananthmail-github@yahoo.com>", "main": "dist/index.js", + "files": [ + "dist" + ], "scripts": { "release": "babel src --out-dir dist && documentation build -f md -o api.md src", "test": "mocha --require=babel-register", @@ -16,7 +19,7 @@ "babel-traverse": "^6.18.0", "babel-types": "^6.18.0", "babylon": "^6.13.0", - "istanbul-lib-coverage": "^1.0.2", + "istanbul-lib-coverage": "^1.1.0", "semver": "^5.3.0" }, "devDependencies": { |