2015-02-18 04:23:58 +03:00
|
|
|
describe "Babel transpiler support", ->
|
2015-08-20 21:25:38 +03:00
|
|
|
describe 'when a .js file starts with /** @babel */;', ->
|
2015-08-19 01:49:34 +03:00
|
|
|
it "transpiles it using babel", ->
|
|
|
|
transpiled = require('./fixtures/babel/babel-comment.js')
|
|
|
|
expect(transpiled(3)).toBe 4
|
|
|
|
|
2015-02-18 04:23:58 +03:00
|
|
|
describe "when a .js file starts with 'use babel';", ->
|
|
|
|
it "transpiles it using babel", ->
|
|
|
|
transpiled = require('./fixtures/babel/babel-single-quotes.js')
|
|
|
|
expect(transpiled(3)).toBe 4
|
|
|
|
|
|
|
|
describe 'when a .js file starts with "use babel";', ->
|
|
|
|
it "transpiles it using babel", ->
|
|
|
|
transpiled = require('./fixtures/babel/babel-double-quotes.js')
|
2015-02-03 00:29:20 +03:00
|
|
|
expect(transpiled(3)).toBe 4
|
|
|
|
|
2015-08-20 02:36:24 +03:00
|
|
|
describe "when a .js file does not start with 'use babel';", ->
|
2015-02-18 04:23:58 +03:00
|
|
|
it "does not transpile it using babel", ->
|
|
|
|
expect(-> require('./fixtures/babel/invalid.js')).toThrow()
|