stubbable-decorator
A decorator to make possible to stub modules in ECMAScript 2015+.
Installation
npm install -S stubbable-decorator
Usage
With a class
//// Module declaration// { thisbar = bar } Foo
//// Testing// Foostub = sinonconst obj = calledOnce // 👍
With a function
//// Module declaration// { return 123 } foo
//// Testing// foostub = sinonconst result = tobe // 👍
With a decorator
In the current spec it is only possible to decorate classes and classes properties.
//// Module declaration// @stubbable { thisbar = bar }
//// Testing// Foostub = sinonconst obj = calledOnce // 👍
Credits
- Icon by Sergey Demushkin from The Noun Project
caiogondim.com · GitHub @caiogondim · Twitter @caio_gondim