File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -281,16 +281,18 @@ class Agent {
281281 if ( this . launcher ?. readPackage ) {
282282 if ( ! this . config . moduleCache ) {
283283 const { modules } = this . launcher . readPackage ( )
284- if ( semver . valid ( modules [ 'node-red' ] ) !== null ) {
285- state . nodeRedVersion = modules [ 'node-red' ]
286- } else {
287- try {
288- const nrPackPath = path . join ( this . launcher . projectDir , 'node_modules/node-red/package.json' )
289- const content = readFileSync ( nrPackPath )
290- const packJSON = JSON . parse ( content )
291- state . nodeRedVersion = packJSON . version
292- } catch ( err ) {
293- // Bad node-red install
284+ if ( modules ) {
285+ if ( semver . valid ( modules [ 'node-red' ] ) !== null ) {
286+ state . nodeRedVersion = modules [ 'node-red' ]
287+ } else {
288+ try {
289+ const nrPackPath = path . join ( this . launcher . projectDir , 'node_modules/node-red/package.json' )
290+ const content = readFileSync ( nrPackPath )
291+ const packJSON = JSON . parse ( content )
292+ state . nodeRedVersion = packJSON . version
293+ } catch ( err ) {
294+ // Bad node-red install
295+ }
294296 }
295297 }
296298 } else {
Original file line number Diff line number Diff line change @@ -606,10 +606,10 @@ describe('Agent', function () {
606606 agent . launcher = Launcher . newLauncher ( )
607607 agent . launcher . reportPackages = true
608608 await agent . start ( )
609- await agent . suspendNR ( )
610- // const state = agent.getState()
609+ const state = agent . getState ( )
611610 // readPackage requires running launcher, but that requires installing packages
612611 // to read versions from
612+ state . should . have . property ( 'mode' )
613613 } )
614614 } )
615615
You can’t perform that action at this time.
0 commit comments