I tried and failed to reproduces the issue in a new project. It is probably something specific about the packages in use or the order in which dependencies are resolved.
Instead I tried a simple fix that passes through the name to the collection constructor and instead sets connection: null in the options object. This failed the package tests because using the same name for subsequent tests meant the changes are persisted between stubs.
The solution then was to postfix the name with a random string. This now passes the package tests and my app's tests.
Using a stub-collection with johanbrook:meteor-publication-collector
sometimes causes the error
Error: Can't publish a cursor from a collection without a name.
The simple fix for this is to create a localCollection with a name. To
ensure that the stubbed collection doesn't connect to an existing local
collection that was stubbed previously, we randomise the name.
I tried and failed to reproduces the issue in a new project. It is probably something specific about the packages in use or the order in which dependencies are resolved.
Instead I tried a simple fix that passes through the name to the collection constructor and instead sets
connection: null
in the options object. This failed the package tests because using the same name for subsequent tests meant the changes are persisted between stubs.The solution then was to postfix the name with a random string. This now passes the package tests and my app's tests.
Using a stub-collection with johanbrook:meteor-publication-collector sometimes causes the error
The simple fix for this is to create a localCollection with a name. To ensure that the stubbed collection doesn't connect to an existing local collection that was stubbed previously, we randomise the name.