Add option to avoid automatic parsing of JSON files in cy.fixture() and cy.readFile() #5395
Please allow json5 (json with comments) for fixtures. Some fixtures are huge and having comments to point out the critical part would be helpful
Steps to reproduce: (app code and test code)
Mac OSX using Cypress 3.4.1
Hey @checketts, we do not propose supporting JSON5, as this is not valid JSON and do not intend to support every form of reading in files - and think this is a concern of the user.
ALTHOUGH, there is no way to get around our current JSON validation to read this file. So we do think there should be a way to get around the validation.
We propose passing an option to the
The simplest name I can think of for the option is
The code for
Here is the code for
You could rename your file that is passed to
Thanks for the excellent write up and included work around! I've incorporated them and they work (almost) perfectly! See checketts/cypress-test-tiny@0229f75#diff-d344d2966988ae770a3305445156ac3e
By changing my file to
However, it appears that my frontend code (Angular) can't parse it, because, as you noted it isn't valid JSON. So I would need to create a command that uses
So my final work around is to use a JS object directly: checketts/cypress-test-tiny@e2da55e
Thanks for this great framework!