-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in.json should be converted to canonical format #19
Comments
As I mentioned in the #20 review, in-json was not meant to be a raw expected result string (that would be called out-json), but rather a loaded JSON input that would be compared either in memory or by a reserialization into any mature/trusted format. That said, I support the change if it helps people use the data in other useful ways and does not break any existing testing. |
|
With the changes brought in by PR #20, the As is, the files are pretty close to line-delimited JSON, for which tools do exist. Therefore, would it be possible to add a step that would use something like I encountered this problem while updating the tests of my JS YAML library, which can in fact read the import fs from 'fs'
import YAML from 'yaml'
const src = fs.readFileSync('./U9NS/in.json', 'utf8')
const doc = YAML.parseDocuments(src)[0]
doc.errors
// [ [YAMLSyntaxError: Document is not valid YAML (bad indentation?)] ]
doc.contents[0].toJSON()
// { time: '20:03:20',
// player: 'Sammy Sosa',
// action: 'strike (miss)' }
doc.contents[1].toJSON()
// { time: '20:03:47',
// player: 'Sammy Sosa',
// action: 'grand slam' } |
To be able to reliably compare JSON the in.json should all be converted to the default
jq
output.To ensure that also future additions have the correct format, we would need a script that automatically converts in-json in a tml file.
The text was updated successfully, but these errors were encountered: