jest
jest copied to clipboard
/* istanbul ignore next */ is ignored
I switched from ts-jest to swc-jest - everything works but noticed that
/* istanbul ignore next */
export default function ...
that code coverage picks up those lines from the function (when I want them ignored). I'm confused grepping through github on what I should do to get it to work. Should I add preserveAllComments
in .swcrc
(that didn't seem to work) or try something else?
preserveAllComments
works for the most part -- it seems to flag this as not covered, which seems odd given that it should be ignoring the whole arrow func.
Try to do empty line:
@YozhEzhi that's an "ignore file" rather than "ignore next"
Okay so I encountered this issue again 1 year later and actually just figured out a workaround that seems to work for some files but not others
Instead of
/* istanbul ignore next */
export default function ...
do
/* istanbul ignore next
// Newline needed for istanbul next to work
*/
export default function ...
or even
/* istanbul ignore next
*/
export default function ...