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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier replay of failing scheduler #595

Closed
dubzzz opened this issue May 15, 2020 · 0 comments · Fixed by #588
Closed

Easier replay of failing scheduler #595

dubzzz opened this issue May 15, 2020 · 0 comments · Fixed by #588

Comments

@dubzzz
Copy link
Owner

dubzzz commented May 15, 2020

🚀 Feature Request

Easier replay of failing scheduler

Motivation

While fast-check offers a simple way to replay failures based on seed and path, schedulers cannot be replayed using the the examples options offered on fc.assert.

While working on the PR facebook/react#18721 on React, I have been challenged on this topic: it should be easier to set custom examples related to schedulers.

Example

Among the possible options here are some that came in my mind to offer this kind of capabilities on schedulers:

fc.assert(
  fc.property(fc.scheduler(), () => {/*code*/}),
  {
    examples: [
      // scheduler resolving tasks in the order 1, 5, 4, 3, 2
      fc.schedulerFor([1, 5, 4, 3, 2]/*, opt constraints*/),
      // same scheduler but this one is one copied and pasted from previous tests failures
      fc.schedulerFor(/*opt constraints*/)`
        -> [task#${1}] promise pending
        -> [task#${5}] promise pending
        -> [task#${4}] promise pending
        -> [task#${3}] promise pending
        -> [task#${2}] promise pending
      ` 
    ]
  }
);

One of the issue we have today is that fc.scheduler can be receive a custom act function and we will also need to pass it to the schedulerFor and this why we use schedulerFor(). Alternatively we may configure this custom act later in the code 🤔

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

Successfully merging a pull request may close this issue.

1 participant