node-red-node-test-helper icon indicating copy to clipboard operation
node-red-node-test-helper copied to clipboard

Ensure hooks and plugins are included in the mock runtime api

Open knolleary opened this issue 1 year ago • 4 comments

Alternative fix to #73 - rather than stub it, expose the real internal plugin api.

knolleary avatar Dec 22 '23 14:12 knolleary

Initial testing suggests more is needed. Parking for now - will merge/release with #73 to unblock some other work that is happening and come back to this another day.

knolleary avatar Dec 22 '23 14:12 knolleary

Just tried this locally, and this._RED.plugins is undefined in the index.js

joepavitt avatar Dec 22 '23 15:12 joepavitt

Mentioned that it should have been this._RED.runtime.plugins

Even with this, we then see different behaviour to core:

Test Helper:

RED.plugins.getByType('node-red-dashboard-2') returns Promise { [ ] }

Node-RED Core:

RED.plugins.getByType('node-red-dashboard-2') returns []

joepavitt avatar Dec 22 '23 15:12 joepavitt

@joepavitt that is odd. Can't see anything async in either code path that would result in a promise.

knolleary avatar Dec 22 '23 15:12 knolleary