jeffrifwald/babel-istanbul

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

XGHeaven opened this issue · 2 comments

The first question is

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

Then, I have follow project:

  • foo.js
  • test
    • foo.spec.js

And ,the second question is

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

@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.

@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