wavded / babel-tape-runner

Babel + Tape runner for your ESNext code
134 stars 16 forks source link

how to invoke polyfill? #7

Closed djMax closed 8 years ago

djMax commented 8 years ago

I'm using async/await and thus need the polyfill. Can babel-tape-runner add that somehow?

brigand commented 8 years ago

I think you can do import 'babel-polyfill' to get the polyfill (install it first, of course).

Docs: https://babeljs.io/docs/usage/polyfill/

djMax commented 8 years ago

Sure, but the problem is now I have to do that in every test file because I don't know which will run first. Essentially I want an option to the runner that will either import the polyfill or import some file I make that imports the polyfill. I need a "before all" type of thing

wavded commented 8 years ago

I haven't migrated to babel-core 6 yet, I'm guessing it doesn't include the polyfill anymore? seems like that should be provided in babel-tape-runner to match the existing functionality, or do people disagree? can you specify to use the polyfill in your .babelrc ?

djMax commented 8 years ago

I'm just migrating myself, so I may be getting this wrong, but it seems you have to include the polyfill at runtime and not in the babelrc.

aaronshaf commented 8 years ago

+1

wavded commented 8 years ago

2.0.0 now includes the polyfill