Skip to content

Context and running streaks in parallel. #56

Open
@pygy

Description

@pygy

This isn't a concern as far as Mithril or ospec itself are concerned, but a test suite that make async requests may see its run time dominated by network and remote work latency. In these scenarios, it could make sense to have streaks (a task and its corresponding beforeEach and afterEach hooks) run in parallel.

In that scenario, having them all share a context object would make a lot of sense.

The v5 API has a nice affordance for this with the injected o object.

We could have o("some test", (o, {spy, context, timeout} = o) => {...}) or even o("", ({o, spy, context, timeout}) => {...}) (if o.o ===o).

context could prototypically inherit from the spec context passed to before and after hooks (each spec having its own context that inherits from parent specs).

A context object is necessary in parallel mode because we can't rely on the closure variables not to be clobbered by other streaks running in parallel.

We could use o.parallel(maxParallelism?, callback), or overload o.spec(name, options = {parallel: false|number}, callback).

The latter is probably preferable.

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