Skip to content

Commit 44c12a0

Browse files
authored
feat: Report nodejs version (#657)
1 parent a6e12e7 commit 44c12a0

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

lib/agent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ class Agent {
276276
snapshotRestartCount: this.launcher?.restartCount || 0
277277
},
278278
agentVersion: this.config.version,
279-
licensed: this.config.licensed
279+
licensed: this.config.licensed,
280+
nodejsVersion: process.version
280281
}
281282
if (this.launcher?.readPackage) {
282283
if (!this.config.moduleCache) {

test/unit/lib/agent_spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,29 @@ describe('Agent', function () {
658658
// now that state has been retrieved, reportPackages should be reset to false
659659
agent.mqttClient.reportPackages.should.be.false()
660660
})
661+
it('includes NodeJS version', async function () {
662+
const agent = createMQTTAgent()
663+
agent.launcher = Launcher.newLauncher()
664+
agent.launcher.readPackage = sinon.stub().returns({
665+
modules: {
666+
'node-red': '5.0.0'
667+
}
668+
})
669+
agent.launcher.reportPackages = sinon.stub().returns({
670+
packageList: {
671+
'node-red-node-random': '1.0.0',
672+
'node-red-contrib-other': '1.2.3'
673+
},
674+
moduleCache: 'xyz'
675+
})
676+
await agent.start()
677+
678+
agent.mqttClient.reportPackages = true
679+
680+
// Call getState and validate results
681+
const state = agent.getState()
682+
state.should.have.property('nodejsVersion', process.version)
683+
})
661684
})
662685

663686
describe('setState', function () {

0 commit comments

Comments
 (0)