Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个回调,我想看看它是否被调用了两次。
我已经查看t.plan并在常见问题解答中说它是一个很好的用例,t.plan但您必须明确定义t.end(). 但在我的情况下,它是相同的回调。
t.plan
t.end()
这怎么可能?
我会做类似的事情:
test.cb('called twice', t => { let remaining = 2 runCode(() => { remaining-- if (remaining === 0) { t.end() } }) })