5

Wanted this part of the code to be ignored in jest coverage

/* istanbul ignore next */
async middleware(
    req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>,
    _res: Response<any, Record<string, any>>,
    next: NextFunction
) {
    const { email, password } = req.body
    await validate({ email, password })

    next()
}

I tried with /* istanbul ignore next */ but it doesn't seem to work

coverage result

Aranneuxo
  • 51
  • 3
  • Have you tried to put the /* Istanbul ignore next */ comment next to the function name, right before the parameters? – Farista Latuconsina Nov 28 '22 at 11:17
  • I have the same problem. I put the /* Istanbul ignore next */. I put it in several positions, but it´s not working. I am using: "nyc": "^15.1.0" and "ts-jest": "^29.0.5", "jest": "^29.5.0", "ts-jest": "^29.0.5". I put the comment (before/after function name, before/after function parameters) but the ```/* Istanbul ignore next */ ``` not working in any position. – PairProgramming Apr 04 '23 at 22:10

0 Answers0