This is a possible approach to create a set of tests (child.js
) that can be imported into another project (parent.js
) and run through it.
This kind of approach also allows to pass parameters and options to the initial set of tests (in this case si
).
Another possible approach is to just return lab
from the child test and have it re-exported by parent (in this case parameteres would need to be added to tests
).
Tests are run with lab parent.js
.
This has been explored for use in seneca-store-test. Using this approach we can refactore seneca-store-test to directly use experiments and tests (or describe/it in BDD parlance) while still depende on store implementation to provide a correctly configured seneca instance. The added benefits imho are:
- easier and clearer for stores to implement
- better reporting
- more tools available to seneca-store-test to write tests (e.g.: before, after)