Create a new
expect function that maintains a close relationship
to the instance it is created from. The child instance has access to
all assertions, types, and styles defined in the parent, even ones
that are added after
child() is called.
This is mostly useful when creating plugins that have secondary dependencies that can aid in implementing the plugin itself, but which should not leak out into the "primary" instance belonging to the user. This can avoid a class of dependency hell-like problems -- for instance when a plugin depends on another plugin that's also installed directly by the user at the top level, and most likely in an incompatible version.
The child instance has the ability to export assertions, types, and styles
to the parent using the
methods. These methods have the same signature as
addStyle, respectively, but affect the parent
Note that in order to reference a type in the signature used with
exportAssertion, the type itself must also be exported to the parent
In other words, this won't work:
It can be fixed by exporting the
foosomething type instead of just adding it
to the child.