rewire
rewire copied to clipboard
How to rewire if exported a function only
Suppose you only export a function
export default function () {
return Math.random();
}
Is it now possible to use rewire
?
For example, the following doesn't work
import rewire from 'rewire';
let bar = rewire('./bar');
bar.__set__(() => { .... });
Is this possible ?
@scaljeri My guess is you'll have to wrap it in another service / module and rewire that. Maybe someone else will have an idea