diff --git a/package-lock.json b/package-lock.json index 9420f82..f900acf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "coffee-coverage", + "name": "coffee-coverage-v2", "version": "2.0.1", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 8bcfdbd..7bfb012 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "coffee-coverage", + "name": "coffee-coverage-v2", "description": "Istanbul and JSCoverage-style instrumentation for CoffeeScript files.", "keywords": [ "javascript", @@ -12,7 +12,7 @@ "jscoverage", "coveralls" ], - "version": "2.0.1", + "version": "2.0.2", "author": "Benbria (http://www.benbria.com/)", "contributors": [ "Jason Walton (https://github.com/jwalton)", @@ -52,7 +52,7 @@ "sinon": "^1.14.1" }, "scripts": { - "prepublish": "npm run build", + "prepublish": "npm run build && mocha", "test": "npm run build && mocha && istanbul report", "coverage-report": "istanbul report text-summary lcov", "build": "coffee -c -o lib src", @@ -60,6 +60,6 @@ "distclean": "npm run clean && rm -rf node_modules" }, "engines": { - "node": ">=0.8.0" + "node": ">=8.9.0" } } diff --git a/src/coffeeCoverage.coffee b/src/coffeeCoverage.coffee index 88b52a7..2c6b522 100644 --- a/src/coffeeCoverage.coffee +++ b/src/coffeeCoverage.coffee @@ -25,8 +25,9 @@ exports.INSTRUMENTORS = INSTRUMENTORS = { } class CoverageError extends Error - constructor: (@message) -> - super message + constructor: (message) -> + super() + @message = message @name = "CoverageError" Error.captureStackTrace this, arguments.callee diff --git a/src/instrumentors/Istanbul.coffee b/src/instrumentors/Istanbul.coffee index 0657d9c..cb18b6d 100644 --- a/src/instrumentors/Istanbul.coffee +++ b/src/instrumentors/Istanbul.coffee @@ -148,6 +148,12 @@ module.exports = class Istanbul # Called on each non-comment statement within a Block. If a `visitXXX` exists for the # specific node type, it will also be called after `visitStatement`. visitStatement: (node) -> + grandParentType = node.parent?.parent?.node?.constructor?.name + + if grandParentType is "StringWithInterpolations" and !node.parent.parent.skipped + node.parent.parent.skipped = true + return + # Ignore nodes marked 'noCoverage' return if node.isMarked('noCoverage')