【发布时间】:2018-06-18 11:59:31
【问题描述】:
是否可以使用 Jest (Jasmine) 获取当前执行的测试名称或在测试内部进行描述?
使用 Jasmine: How to get name of current test 不再有效,至少在 Jest 中是这样。
例如
test('Error missing body', (done) => {
console.log('Currently executing: ' + REFERENCE_TO_TEST_NAME);
done();
});
谢谢
【问题讨论】:
-
这是Get the current test/spec name in Jest 的完全相同的副本,虽然更新,但答案质量更高,sourced from the Jest GitHub repo。
-
这能回答你的问题吗? Get the current test/spec name in Jest