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

auto use babal-core/register? and no effect in test file? #50

Closed XGHeaven closed 8 years ago

XGHeaven commented 8 years ago

The first question is

question 1: babel-istabul use babel-core/register automatically?

Then, I have follow project:

And ,the second question is

question 2: Why can I use import in foo.js, not in foo.spec.js?

jeffrifwald commented 8 years ago

@XGHeaven This tool does not make assumptions about how you are going to run your tests, so it does not use register.

The reason you are having trouble with syntax in your spec file likely means you are not running your tests through babel. Try running your tests with babel-node instead of node.

XGHeaven commented 8 years ago

@jmcriffey babel-node has a bug, So I have to use node5.

class Test extends Map {
    get() { return 1; }
}
new Test().get()

in babel-node

undefined

in node5

1