Wildhoney / Mocktail

:tropical_drink: Mock all of your ES6 module components with Mocktail using dependency injection.
http://mocktail.herokuapp.com/
MIT License
103 stars 6 forks source link

How to mock plain functions? #8

Closed screendriver closed 8 years ago

screendriver commented 8 years ago

Assume you have

foo.js

import { mock } from 'mocktail';

export function bar() {
  return 'i am bar';
}

and I don't want to have my stub / mock in my source file (because it's a bad design and bloats the production source code size), how can I mock bar() in my tests?

nhz-io commented 8 years ago

https://github.com/nhz-io/babel-plugin-mocktail

Wildhoney commented 8 years ago

Awesome work, @nhz-io!

screendriver commented 8 years ago

Thank you. I will try to get it running with my jspm / SystemJS setup.