Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/* istanbul ignore next */ is ignored #119

Open
k2xl opened this issue Aug 29, 2022 · 4 comments
Open

/* istanbul ignore next */ is ignored #119

k2xl opened this issue Aug 29, 2022 · 4 comments

Comments

@k2xl
Copy link

k2xl commented Aug 29, 2022

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?

@akhileshraju
Copy link

akhileshraju commented Nov 24, 2022

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.

image

@YozhEzhi
Copy link

Try to do empty line:

image

@ctsstc
Copy link

ctsstc commented Jul 14, 2023

@YozhEzhi that's an "ignore file" rather than "ignore next"

@k2xl
Copy link
Author

k2xl commented Dec 30, 2023

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 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants