Constellation / ibrik

CoffeeScript meets Istanbul - code coverage tool for CoffeeScript
BSD 2-Clause "Simplified" License
79 stars 32 forks source link

Ibrik not correctly instrumenting some classes. #17

Closed DavidSouther closed 10 years ago

DavidSouther commented 10 years ago

It seems Ibrik has problems with instrumenting code with empty prototype bodies:

myclass.coffee

class MyClass
    constructor: ->
        @foo()
    foo: ->

myInst = new MyClass()
$ ./node_modules/.bin/ibrik cover temp.coffee
Transformation error; return original code
TypeError: Cannot read property 'loc' of undefined
    at Controller.<anonymous> (./node_modules/ibrik/lib/instrumenter.js:88:38)
    at Controller.estraverse.traverse.leave (./node_modules/ibrik/lib/instrumenter.js:125:15)
    at Controller.__execute (./node_modules/ibrik/node_modules/estraverse/estraverse.js:317:31)
    at Controller.traverse (./node_modules/ibrik/node_modules/estraverse/estraverse.js:383:28)
    at Object.traverse (./node_modules/ibrik/node_modules/estraverse/estraverse.js:555:27)
    at Instrumenter.fixupLoc (./node_modules/ibrik/lib/instrumenter.js:69:25)
    at Instrumenter.instrumentSync (./node_modules/ibrik/lib/instrumenter.js:63:12)
    at ./node_modules/ibrik/lib/hook.js:20:25
    at Object.require.extensions..coffee (./node_modules/ibrik/lib/hook.js:48:13)
    at Module.load (module.js:356:32)
[TypeError: Cannot read property 'loc' of undefined]
No coverage information was collected, exit without writing coverage information
DavidSouther commented 10 years ago

In fact, it seems to be noops in general. Same issue with

foo = ->
foo()