-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #611 from Galooshi/mika-babel-parser-plugins-override
Provide the option to override parser plugins in configuration
- Loading branch information
Showing
7 changed files
with
134 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,49 @@ | ||
import path from 'path'; | ||
import parse from '../parse'; | ||
import parse, { configureParserPlugins } from '../parse'; | ||
|
||
const local = (subPath) => path.resolve(__dirname, subPath); | ||
|
||
it('knows about object rest spread', () => { | ||
it('infer typescript from file extension', () => { | ||
expect(() => | ||
parse( | ||
` | ||
const { a, b, ...c } = foo; | ||
`, | ||
local('foo,js'), | ||
class Employee { | ||
private name: string; | ||
} | ||
`, | ||
local('foo.tsx'), | ||
), | ||
).not.toThrowError(); | ||
}); | ||
|
||
it('knows about decorators', () => { | ||
it('should understand Flow without being told to', () => { | ||
expect(() => | ||
parse( | ||
` | ||
@Awesome | ||
class Foo {}; | ||
`, | ||
local('foo,js'), | ||
const a : string = "hello"; | ||
`, | ||
local('foo.js'), | ||
), | ||
).not.toThrowError(); | ||
}); | ||
|
||
it('knows about class properties', () => { | ||
expect(() => | ||
parse( | ||
` | ||
class Foo { | ||
foo = 'bar'; | ||
} | ||
`, | ||
local('foo,js'), | ||
), | ||
).not.toThrowError(); | ||
}); | ||
it('should include plugins provided', () => { | ||
configureParserPlugins([ | ||
[ | ||
'pipelineOperator', | ||
{ | ||
proposal: 'hack', | ||
topicToken: '%', | ||
}, | ||
], | ||
]); | ||
|
||
it('knows about dynamic imports', () => { | ||
expect(() => | ||
parse( | ||
` | ||
import('./foo').then(module => module()); | ||
`, | ||
local('foo,js'), | ||
"hello" |> console.log(%); | ||
`, | ||
local('foo.js'), | ||
), | ||
).not.toThrowError(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters