benbria / coffee-coverage

Istanbul and JSCoverage-style instrumentation for CoffeeScript files.
MIT License
145 stars 31 forks source link

Coffee-coverage fails since Coffeescript@2.5.0 was released #99

Open CSester opened 4 years ago

CSester commented 4 years ago

Coffee-coverage crashes since coffee-script 2.5.0 was released with following trace:

Error: Don't know how to insert statement into If.elseBody: undefined at NodeWrapper.insertAtStart (project/node_modules/coffee-coverage/lib/NodeWrapper.js:209:15) at Istanbul.visitIf (project/node_modules/coffee-coverage/lib/instrumentors/Istanbul.js:307:14) at runVisitor (project/node_modules/coffee-coverage/lib/coffeeCoverage.js:402:22) at project/node_modules/coffee-coverage/lib/coffeeCoverage.js:415:16 at NodeWrapper.forEachChildOfType (project/node_modules/coffee-coverage/lib/NodeWrapper.js:76:13) at node.children.forEach (project/node_modules/coffee-coverage/lib/NodeWrapper.js:59:23) at Array.forEach (:null:null) at NodeWrapper.forEachChild (project/node_modules/coffee-coverage/lib/NodeWrapper.js:58:35) at runVisitor (project/node_modules/coffee-coverage/lib/coffeeCoverage.js:414:26) at project/node_modules/coffee-coverage/lib/coffeeCoverage.js:415:16 at NodeWrapper.forEachChildOfType (project/node_modules/coffee-coverage/lib/NodeWrapper.js:76:13) at node.children.forEach (project/node_modules/coffee-coverage/lib/NodeWrapper.js:59:23)

oozcitak commented 4 years ago

I have the same error:

Error: Don't know how to insert statement into If.elseBody: undefined

I also confirm that downgrading to coffeescript 2.4.1 fixes this.

STRd6 commented 2 years ago

I'm working on a fix for this on my fork.

Here's a patch that should be good until I can cut a release: https://github.com/STRd6/coffee-coverage/commit/6cd95a2de68ded063e2abc8da14ca4b4ad2e2504

jwalton commented 2 years ago

I no longer work at Benbria so I can’t push to this repo anymore, and I haven’t written any coffee-script in a very long time. Benbria never moved to a 2.x release of coffee-script because we figured it would be easier to decaffeinate our code base than to figure out all the problems involved with upgrading to 2.x. (I don’t think we were even on the latest 1.x, because it has breaking changes for us.) So I doubt Benbria had much interest in maintaining this, unfortunately.

STRd6 commented 2 years ago

Thanks for the update Jason.

I've still got a need for this in my life so I'll see if I can maintain an up to date fork for myself and the half dozen of us still using CoffeeScript :)

Also I just wanted to say "Thank you!" for the work you've done on this over the years, it made my life better for sure.

jwalton commented 2 years ago

@STRd6 Aw, thanks Daniel! That's kind of you to say. This was a fun project to work on. I started this only a few weeks after learning Coffee-Script. The first thing I needed to do was to get coffee-script to accept a PR so it tracked the line number/column number all the way through the compiler, and in order to do that I ended up implementing the first version of source-maps in the coffee-script compiler. :) It was lots of fun. Good luck keeping it running!