how to parse a piece of info out of failureMessage string for generated result from a jest test suit run?

150 Views Asked by At

the string looks like this after I did JSON.stringify the whole object

'Error: Expected image to match or be a close match to snapshot but was 0.009980258828690502% different from snapshot (91 differing pixels).\n\u001b[1m\u001b[31mSee diff for details:\u001b[39m\u001b[22m \u001b[31m/src/pages/__image_snapshots__/__diff_output__/register-test-js-register-page-register-automated-desktop-control-1-diff.png\u001b[39m\n at Object.toMatchImageSnapshot (/src/command/getPageImageShot.js:62:25)\n at <anonymous>\n at process._tickCallback (internal/process/next_tick.js:189:7)'

This value does not seems as a result of my json.stringify, as its the value within an object as a string by itself.

I wonder how can I parse out the whole path string (in this case its the path after See diff for details but without all the gibberish in between) from this clumb of mess? and what process produced all the 39m, 22m, u0001b, etc? Is parsing it the best way? Maybe I overlooked some better approach?

I woonder

0

There are 0 best solutions below