任何建议如何使用Sinon
with ava
?当我跑步时ava
,stub.called
总是false
目标.js
const foo = () => { bar() }
const bar = () => { }
module.exports = { foo, bar }
目标.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)
})