mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
allow the use of double slash flow comments
This commit is contained in:
@@ -42,6 +42,11 @@ describe "Babel transpiler support", ->
|
||||
transpiled = require('./fixtures/babel/flow-comment.js')
|
||||
expect(transpiled(3)).toBe 4
|
||||
|
||||
describe 'when a .js file starts with // @flow', ->
|
||||
it "transpiles it using babel", ->
|
||||
transpiled = require('./fixtures/babel/flow-slash-comment.js')
|
||||
expect(transpiled(3)).toBe 4
|
||||
|
||||
describe "when a .js file does not start with 'use babel';", ->
|
||||
it "does not transpile it using babel", ->
|
||||
spyOn(console, 'error')
|
||||
|
||||
4
spec/fixtures/babel/flow-slash-comment.js
vendored
Normal file
4
spec/fixtures/babel/flow-slash-comment.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
// @flow
|
||||
|
||||
const f: Function = v => v + 1
|
||||
module.exports = f
|
||||
@@ -11,7 +11,8 @@ var PREFIXES = [
|
||||
'/** @babel */',
|
||||
'"use babel"',
|
||||
'\'use babel\'',
|
||||
'/* @flow */'
|
||||
'/* @flow */',
|
||||
'// @flow'
|
||||
]
|
||||
|
||||
var PREFIX_LENGTH = Math.max.apply(Math, PREFIXES.map(function (prefix) {
|
||||
|
||||
Reference in New Issue
Block a user