This passes
test('test_test', async () => {
try {
const received = true;
const expected = false;
expect(received).toBe(expected);
} catch (err) {
return err
}
});
This fails as it should
test('test_test', () => {
try {
const received = true;
const expected = false;
expect(received).toBe(expected);
} catch (err) {
return err
}
});
I have a function using async and await and this is the reason the test will not fail so I'm trying to understand how to make the top fail as it should.
正如@jonrsharpe 建议删除try
/ catch
它现在按预期运行并且失败。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.