获取当前执行的描述/测试名称 [英] Get currently executed describe/test name
本文介绍了获取当前执行的描述/测试名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可以用jest(jasmine)生成测试的当前执行名称或在测试内部进行描述吗?
is it possible with jest(jasmine) to ge the currently executed name of the test or describe inside the test?
使用 Jasmine:如何获取当前测试的名称不再起作用,或者至少不能开玩笑.
Using Jasmine: How to get name of current test is not working anymore or at least with jest.
例如
test('Error missing body', (done) => {
console.log('Currently executing: ' + REFERENCE_TO_TEST_NAME);
done();
});
谢谢
推荐答案
const testParam = 'any text you need';
describe(`${testParam}`, () => {
test('mind the backtick', () => {
console.log(`Currently executing: ${testParam}`);
});
});
这篇关于获取当前执行的描述/测试名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文