From 6ef90569e875743a976101950665987e190e7add Mon Sep 17 00:00:00 2001 From: Emanuele Tamponi Date: Fri, 10 Nov 2017 15:41:08 +0100 Subject: [PATCH] all tests pass with coffeescript v2 --- package.json | 5 +++-- src/NodeWrapper.coffee | 5 ++--- src/coffeeCoverage.coffee | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9c45477..3b5e853 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "jscoverage", "coveralls" ], - "version": "2.0.2", + "version": "2.0.3", "author": "Benbria (http://www.benbria.com/)", "contributors": [ "Jason Walton (https://github.com/jwalton)", @@ -22,7 +22,8 @@ "David Dahl (https://github.com/effata)", "David Kirstein (https://github.com/frozenice-)", "Dmitry Petrov (https://github.com/can3p)", - "Devon Govett (https://github.com/devongovett)" + "Devon Govett (https://github.com/devongovett)", + "Emanuele Tamponi (https://glitch.com/@etamponi)" ], "license": "MIT", "main": "./lib/index", diff --git a/src/NodeWrapper.coffee b/src/NodeWrapper.coffee index edff013..3a9bf52 100644 --- a/src/NodeWrapper.coffee +++ b/src/NodeWrapper.coffee @@ -28,15 +28,14 @@ module.exports = class NodeWrapper # TODO: Is this too naive? coffeescript nodes have a `isStatement(o)` function, which # really only cares about `o.level`. Should we be working out the level and calling # this function instead of trying to figure this out ourselves? - @isStatement = @parent? and @type isnt 'Comment' and - @parent.type is 'Block' and @childName is 'expressions' + @isStatement = @parent? and @parent.type is 'Block' and @childName is 'expressions' # Note we exclude 'Value' nodes. When you parse a Class, you'll get Value nodes wrapping # each contiguous block of function assignments, and we don't want to treat these as # statements. I can't think of another case where you have a Value as a direct child # of an expression. if @isStatement and @type is 'Value' and @parent.parent?.type is 'Class' - @isStatement = false + @isStatement = @node.base.constructor?.name is "Call" @isSwitchCases = @childName is 'cases' and @type is 'Array' diff --git a/src/coffeeCoverage.coffee b/src/coffeeCoverage.coffee index 2ac4006..fa57a33 100644 --- a/src/coffeeCoverage.coffee +++ b/src/coffeeCoverage.coffee @@ -29,7 +29,7 @@ class CoverageError extends Error super() @message = message @name = "CoverageError" - Error.captureStackTrace this, arguments.callee + Error.captureStackTrace this, CoverageError # Default options. factoryDefaults = @@ -358,7 +358,6 @@ exports._runInstrumentor = (instrumentor, fileName, source, options={}) -> # Compile the instrumented CoffeeScript and write it to the JS file. try js = ast.compile coffeeOptions - console.log js catch err ### !pragma coverage-skip-block ### throw new CoverageError("Could not compile #{fileName} after instrumenting: #{err.stack}")