Jest中的"it"和"test"有什么区别? [英] What is the difference between 'it' and 'test' in Jest?
本文介绍了Jest中的"it"和"test"有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的测试组中有两个测试.其中一项测试使用it
,另一项使用test
.他们似乎在工作上非常相似.它们之间有什么区别?
I have two tests in my test group. One of the tests use it
and the other one uses test
. Both of them seem to be working very similarly. What is the difference between them?
describe('updateAll', () => {
it('no force', () => {
return updateAll(TableName, ["fileName"], {compandId: "test"})
.then(updatedItems => {
let undefinedCount = 0;
for (let item of updatedItems) {
undefinedCount += item === undefined ? 1 : 0;
}
// console.log("result", result);
expect(undefinedCount).toBe(updatedItems.length);
})
});
test('force update', () => {
return updateAll(TableName, ["fileName"], {compandId: "test"}, true)
.then(updatedItems => {
let undefinedCount = 0;
for (let item of updatedItems) {
undefinedCount += item === undefined ? 1 : 0;
}
// console.log("result", result);
expect(undefinedCount).toBe(0);
})
});
});
test
似乎在 Jest的官方API 中,但是it
不是.
It seems that test
is in the official API of Jest, but it
is not.
推荐答案
it
是test
的别名.所以它们是完全一样的.
The Jest docs state it
is an alias of test
. So they are exactly the same.
这篇关于Jest中的"it"和"test"有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文