Skip to content

Commit

Permalink
all tests pass with coffeescript v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Tamponi committed Nov 10, 2017
1 parent 150014b commit 6ef9056
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -12,7 +12,7 @@
"jscoverage",
"coveralls"
],
"version": "2.0.2",
"version": "2.0.3",
"author": "Benbria (http://www.benbria.com/)",
"contributors": [
"Jason Walton <dev@lucid.thedreaming.org> (https://github.com/jwalton)",
Expand All @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions src/NodeWrapper.coffee
Expand Up @@ -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'

Expand Down
3 changes: 1 addition & 2 deletions src/coffeeCoverage.coffee
Expand Up @@ -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 =
Expand Down Expand Up @@ -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}")
Expand Down

0 comments on commit 6ef9056

Please sign in to comment.