Meteor-Community-Packages / meteor-publication-collector

Test a Meteor publication by collecting its output.
https://atmospherejs.com/johanbrook/publication-collector
MIT License
33 stars 20 forks source link

Breaking with peerlibrary:reactive-publish's "autorun" #20

Closed jaskinn closed 7 years ago

jaskinn commented 7 years ago

I have run into a problem with peerlibrary:reactive-publish where "publish._isDeactivated" is not a function.

TypeError: publish._isDeactivated is not a function
       at Computation.<anonymous> (packages/peerlibrary_reactive-publish.js:354:24)
       at runWithEnvironment (packages/meteor.js:1176:24)
       at packages/meteor.js:1189:14
       at packages/peerlibrary_server-autorun.js:474:23
       at packages/peerlibrary_server-autorun.js:452:18
       at Function.FiberUtils.synchronize (packages/peerlibrary_fiber-utils.js:188:12)
       at Computation.Tracker.Computation.Computation._runInside (packages/peerlibrary_server-autorun.js:441:23)
       at packages/peerlibrary_server-autorun.js:466:22
       at Function.FiberUtils.synchronize (packages/peerlibrary_fiber-utils.js:188:12)
       at Computation.Tracker.Computation.Computation._compute (packages/peerlibrary_server-autorun.js:463:23)
       at new Computation (packages/peerlibrary_server-autorun.js:335:12)
       at Object.Tracker.autorun (packages/peerlibrary_server-autorun.js:253:7)
       at PublicationCollector.publish.autorun (packages/peerlibrary_reactive-publish.js:340:24)
       at imports/api/users/server/publications.js:52:22
       at PublicationCollector.<anonymous> (imports/api/users/server/publications.js:29:22)
       at PublicationCollector.<anonymous> (packages/peerlibrary_subscription-data.js:234:30)
       at PublicationCollector.<anonymous> (packages/peerlibrary_reactive-publish.js:371:30)
       at PublicationCollector.collect (packages/johanbrook:publication-collector/publication-collector.js:44:20)
       at Test.<anonymous> (imports/api/users/server/publicatons.test.js:35:19)

I wonder if this is along the same lines as the last issue that related to peerlibrary:reactive-publish?

johanbrook commented 7 years ago

Hey! Yeah, the reactive publish package is probably monkey patching the publishing functions in Meteor somehow, and thus the function _isDeactivated isn't provided in this test package. See the code along these lines, where we are providing the necessary properties for other libs to use: https://github.com/johanbrook/meteor-publication-collector/blob/master/publication-collector.js#L20-L24

Would you be able to identify what reactive publish needs, add a test for it, and provide a PR?

jaskinn commented 7 years ago

I will give it a go.