Quantcast
Channel: User user2297996 - Stack Overflow
Viewing all articles
Browse latest Browse all 39

Answer by user2297996 for How to put a spy to a single function using SinonJS?

$
0
0

Just to clarify:

In order to be able to use Sinon spies, you need to export your module functionality in a certain way. Basically, use classes or objects.

Works:

export default {func() {},func2() {}}export const someLib {func() {},func2() {}}module.exports = {func() {}}class Ping {func() {}}export default Ping();

or something similar.

What doesn't work:

export function func() {}export function func2  {}export const foo = () => {}

and so on..


Viewing all articles
Browse latest Browse all 39

Trending Articles