You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings.
I'm using the "dev" configuration from the package.json (using moleculer-runner) using Moleculer version 0.13.13 (TypeScript). I have the following code in moleculer.config.ts (excerpt):
Except of adding these functions I also added NATS configuration of 3 options, and it works.
When I run npm run dev, these functions are not called, and I don't see those messages (and any other code there won't run).
Debugging through the code led me to the node_modules/moleculer/src/service-broker.js@348, where I can see this code:
...
.then(() => {
if (_.isFunction(this.options.started))
return this.options.started(this);
});
Under debugger it says that this.options.started is undefined, while this.options.brokerConfig includes this "started" event (and "created" as well).
When I run it without moleculer-runner, e.g. using jest in tests, creating broker with const broker = new ServiceBroker(brokerConfig);, these methods are there and they are being called and run.
How to make it call these "created" and "started" events on the broker using moleculer-runner? Thank you.
The text was updated successfully, but these errors were encountered:
OK, I figured it out.
I have changed module.exports to export const, and that led to this error.
Now I had to change the import in my tests to this: const brokerConfig = require("../../moleculer.config");
But linter does not like mixing imports and requires.
Greetings.
I'm using the "dev" configuration from the package.json (using moleculer-runner) using Moleculer version 0.13.13 (TypeScript). I have the following code in moleculer.config.ts (excerpt):
Except of adding these functions I also added NATS configuration of 3 options, and it works.
When I run npm run dev, these functions are not called, and I don't see those messages (and any other code there won't run).
Debugging through the code led me to the
node_modules/moleculer/src/service-broker.js@348
, where I can see this code:Under debugger it says that this.options.started is undefined, while this.options.brokerConfig includes this "started" event (and "created" as well).
When I run it without moleculer-runner, e.g. using jest in tests, creating broker with
const broker = new ServiceBroker(brokerConfig);
, these methods are there and they are being called and run.How to make it call these "created" and "started" events on the broker using moleculer-runner? Thank you.
The text was updated successfully, but these errors were encountered: