Skip to content

Difference in JSON formatting on different PCs #9

@PeteHorn

Description

@PeteHorn

I think this is more an issue with the JSONtext library than with Approval Tests, but wanted to raise it here so you're aware. This is my test vi.

Image

I just added the for loop with 2 regex scrubbers at the top to try and solve this, which has worked partially.

The format of the JSON string in the generated file, is different on my dev PC compared to my test VM - in 2 areas:

  • the date formatter generated a different format
  • the build machine has a higher level of pretty printing enabled

I solved the first issue with the 2 regex scrubbers (the two timestamp formats don't seem to be in the list of formats specified in the date scrubber - example date formats at the bottom in case you want to add them to the date scrubber)

Now I just have the issue where the pretty print level is different, so the approved file has the same content but with extra line spacing - see below

Image

I can work around it by breaking out the components of the map and checking separately, but didn't want to have to do that.

Is there anyway to pass through more instructions to JSONtext on how to format strings (I've never messed with that before in JSONtext, always just set pretty print to 10 and leave it there).

Example date formats

5:25:54.034 PM 8/29/2024
16:25:54.034 29/08/2024

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions