Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ class Agent {
snapshotRestartCount: this.launcher?.restartCount || 0
},
agentVersion: this.config.version,
licensed: this.config.licensed
licensed: this.config.licensed,
nodejsVersion: process.version
}
if (this.launcher?.readPackage) {
if (!this.config.moduleCache) {
Expand Down
23 changes: 23 additions & 0 deletions test/unit/lib/agent_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,29 @@ describe('Agent', function () {
// now that state has been retrieved, reportPackages should be reset to false
agent.mqttClient.reportPackages.should.be.false()
})
it('includes NodeJS version', async function () {
const agent = createMQTTAgent()
agent.launcher = Launcher.newLauncher()
agent.launcher.readPackage = sinon.stub().returns({
modules: {
'node-red': '5.0.0'
}
})
agent.launcher.reportPackages = sinon.stub().returns({
packageList: {
'node-red-node-random': '1.0.0',
'node-red-contrib-other': '1.2.3'
},
moduleCache: 'xyz'
})
await agent.start()

agent.mqttClient.reportPackages = true

// Call getState and validate results
const state = agent.getState()
state.should.have.property('nodejsVersion', process.version)
})
})

describe('setState', function () {
Expand Down
Loading