有关Sinon
与ava
如何使用的任何建议吗?
当我运行ava
时,stub.called
始终为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)
})