Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettify the counter example output #4081

Open
hsommerlandreason opened this issue Jul 14, 2023 · 1 comment
Open

Prettify the counter example output #4081

hsommerlandreason opened this issue Jul 14, 2023 · 1 comment

Comments

@hsommerlandreason
Copy link

馃殌 Feature Request

For slightly more complicated inputs it gets quite hard to read the counter example as it is displayed now.

Here is an example of a counterexample i just got:

[{"maxConcurrency":1,"queues":[{"concurrency":1,"kind":0}],"thingsToDo":[{"id":"2s","started":true,"fin
ished":false,"failed":true,"eventCount":1,"shouldFail":true},{"id":"!","started":true,"finished":true,"failed":false,"event
Count":0,"shouldFail":false}]}]

Even tho it is much more verbose, it is much more readable like this:

[
   {
      "maxConcurrency":1,
      "queues":[
         {
            "concurrency":1,
            "kind":0
         }
      ],
      "thingsToDo":[
         {
            "id":"2s",
            "started":true,
            "finished":false,
            "failed":true,
            "eventCount":1,
            "shouldFail":true
         },
         {
            "id":"!",
            "started":true,
            "finished":true,
            "failed":false,
            "eventCount":0,
            "shouldFail":false
         }
      ]
   }
]

I would find it very convenient to have an option to prettify the counter example to make it more readable when the input gets complicated.

@dubzzz
Copy link
Owner

dubzzz commented Jul 17, 2023

Good idea, but probably not for the core package fast-check. I think we should be able to create a package @fast-check/prettier exporting a reporter and asyncReporter backed by prettier and doing what you asked for 馃

Anyway, the idea is good 馃憤
Not sure when it will come in the official repo, but I keep the issue opened for a future task for the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants