Skip to content

Make run metadata available during property execution #6197

@dmurvihill

Description

@dmurvihill

🚀 Feature Request

When checking a property, pass an extra parameter at the end of the values. It can contain information such as the seed, shrink data, run number, etc.

Motivation

I am using fast-check for an end-to-end test. Each property run I create a new database in my Postgres instance. When the run fails, I would like to leave the database in place so I can investigate the database state. I would like to add some information to the database name (and possibly within the database itself) that I can cross-reference with the test output.

Example

  it.prop(
    [fc.array(arbPerson()).chain(arbCommands)],
  )(
    'should preserve invariants throughout operation',
    async (commands, runId) => {
      const databaseName = `papertrace-validation-e2e-test-${new Date().toISOString()}-run-${runId}`;
      // create the database and run the test
    },
  );

Meanwhile, I can count the run number with a variable in a larger scope. That wouldn't help me get the seed though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    💡 Idea to investigateNon straightforward features that seems great but need to be assessed and designed carefully.🚀 Feature Request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions