jeffrifwald / babel-istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
144 stars 23 forks source link

Babel 6.x getter/setter coverage missing #43

Closed silkentrance closed 8 years ago

silkentrance commented 8 years ago

I have just upgraded my environment to babel 6.x and I am now missing coverage on getters and also setters. While both the getters and setters will be instrumentalized, it seems that by accessing them in the test cases, e.g.

    get data()
    {
        return this._data;
    }

    set data(data)
    {
        this._data = data;
    }

and having the below tests

assert.equal(test.prop, 1);
test.prop = 2;
assert.equal(test.prop, 2);

will generate no coverage data at all.

silkentrance commented 8 years ago

Well, it seems to be related to babel 6.x which is no longer able to declare new properties on subclasses of native classes such as Error.

jeffrifwald commented 8 years ago

@silkentrance Do you know if this is a bug and what version of babel it might be fixed in? Thanks.

silkentrance commented 8 years ago

@jmcriffey Sorry i missed that notification. Well, this will not be fixed since it is rather complicated. See https://phabricator.babeljs.io/T6765.

Instead there is now a transformer plugin for enabling users to derive from native classes, so it is can be considered fixed in some way.