在 Jest 中,有没有办法忽略测试覆盖率的代码? 我尝试使用
/* istanbul ignore next */
但似乎不起作用。
最佳答案
它有效。
(function(global) {
var defineAsGlobal = true;
/* istanbul ignore next */
if(typeof exports === 'object') {
module.exports = lib;
defineAsGlobal = false;
}
/* istanbul ignore next */
if(typeof modules === 'object' && typeof modules.define === 'function') {
modules.define('lib', function(provide) {
provide(lib);
});
defineAsGlobal = false;
}
/* istanbul ignore next */
if(typeof define === 'function') {
define(function(require, exports, module) {
module.exports = lib;
});
defineAsGlobal = false;
}
/* istanbul ignore next */
defineAsGlobal && (global.lib = lib);
})(this);
关于code-coverage - 如何在 Jest 中忽略代码覆盖率行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38740165/