moleculerjs / moleculer

:rocket: Progressive microservices framework for Node.js
https://moleculer.services/
MIT License
6.16k stars 586 forks source link

Transit is not exported from the core module #934

Closed JordanPawlett closed 3 years ago

JordanPawlett commented 3 years ago

The transit object does not seem to be exported from the Moleculer module. Meaning it's very hard to write unit-tests for custom transporters.

icebob commented 3 years ago

What do you mean? You can access the transit via broker.transit.

JordanPawlett commented 3 years ago

Sorry for not being more detailed!

I don't think you can import the Transit class e.g. const { Transit} = require('moleculer'). This would be helpful in the instance of writing unit tests for a custom transporter.

transporter = new MyCustomTransporter("custom://custom-server:1234");   
transporter.init(new Transit(new ServiceBroker({ logger: false, namespace: "TEST", nodeID: "node-1" })), msgHandler)
icebob commented 3 years ago

Ahh, I see. Ok