binary-parser icon indicating copy to clipboard operation
binary-parser copied to clipboard

Running "jest --coverage" throws an error when the Parser contains 'formatter'

Open hulinNeil opened this issue 5 years ago • 2 comments

Running "jest --coverage" throws an error when the Parser contains 'formatter'

image

image

hulinNeil avatar Dec 09 '19 07:12 hulinNeil

I am seeing the same error without using formatter, but still using array. Perhaps the issue stems from the Parser contains 'array'

parkerleblanc01 avatar Oct 09 '20 22:10 parkerleblanc01

can use istanbul ignore, has to do with eval and such

parser: new Parser()
    .uint8('compressionMethod', {
      formatter: /* istanbul ignore next */ b => {
        const method = [
          'raw',
          'gzip',
          'bzip2',
          'lzma',
          'rans',
          'rans4x16',
          'arith',
          'fqzcomp',
          'tok3',
        ][b]
        if (!method) {
          throw new Error(`compression method number ${b} not implemented`)
        }
        return method
      },
    })

cmdcolin avatar Jan 03 '23 20:01 cmdcolin