2

Any suggestion how to use Sinon with ava ? when I run ava, stub.called is always false

target.js

const foo = () => { bar() }
const bar = () => { }

module.exports = { foo, bar }

target.test.js

import test from 'ava';
import sinon from 'sinon';
import * as target from './target';

test('foo', t=>{
    const stub = sinon.stub(target, 'bar')    
    target.foo();
    t.true(stub.called)
})
Sing
  • 3,942
  • 3
  • 29
  • 40

0 Answers0