code-coverage
code-coverage copied to clipboard
tilde in a string throws error
Versions "cypress": "^9.1.0", "@cypress/code-coverage": "^3.9.12",
Describe the bug I have a line in my code :
mask += '~`!@#$%^&*()_+-={}[]:";\'<>?,./|\\';
this is leading to an error : SyntaxError: Unexpected token x in JSON at position 2509710 from the command
const coverage = JSON.parse(sentCoverage)
from code-coverage/task.js
when I dive into the sentCoverage it is a string generated by the command JSON.stringify(appCoverageOnly), it looks like this in the problematic section:
}\n if (chars.indexOf('!') > -1) {\n mask += '\x7e`!@#$%^&*()_+-={}[]:\";\\'<>?,./|\\\\';\n }\n\n `
Basically my tilde is getting converted to \x7e and this cannot be parsed as JSON. Everything works perfectly if I just get rid of that one character
Please let me know if more details are warranted.