执行代码覆盖时,我的所有.catch()语句都被揭开了,有没有办法指定/ * istanbul忽略下一个* /某处 ?
前:
function list(req, res, next) {
const { limit = 50, skip = 0 } = req.query;
User.list({ limit, skip })
.then(users => res.json(users))
.catch(e => next(e)); <= this line is marked as uncovered
}
答案 0 :(得分:4)
是的,只需将.catch(e => next(e));
更改为
.catch(
/* istanbul ignore next */
(e) => {
next(e);
});