【发布时间】:2019-04-01 23:00:41
【问题描述】:
因此,如果我将 console.log 放入 test 中,则 console.log 将在测试后出现,例如
authentication.spec.js
register
✓ should be able to insert (128ms)
✓ should fail because of duplicate (100ms)
✓ should have user id assigned (1ms)
login
✓ should be able to login for correct user (117ms)
✓ should fail for incorrect user (14ms)
console.log tests/unit/authentication.spec.js:110
we can see a message
我想看到的是这样的:
authentication.spec.js
register
✓ should be able to insert (128ms)
✓ should fail because of duplicate (100ms)
✓ should have user id assigned (1ms)
login
✓ should be able to login for correct user (117ms)
console.log tests/unit/authentication.spec.js:110
we can see a message
✓ should fail for incorrect user (14ms)
所以在这种情况下console.log 应该与✓ should be able to login for correct user 一起出现
当我使用 Mocha 时,我使用的是 mocha-logger
【问题讨论】:
-
可能相关:stackoverflow.com/questions/58936650/…(可以取消对失败测试的检查,改为显示所有测试的控制台输出)
标签: javascript testing jestjs