diff --git a/js/node-client/getNextTestInfo.js b/js/node-client/getNextTestInfo.js index a398d63..eb71513 100644 --- a/js/node-client/getNextTestInfo.js +++ b/js/node-client/getNextTestInfo.js @@ -23,7 +23,7 @@ module.exports = async function( options ) { }, options ); - let response = {}; + let response = null; try { response = await axios( `${options.serverURL}/aquaserver/next-test?old=${options.old}` ); } @@ -31,9 +31,9 @@ module.exports = async function( options ) { throw new Error( `axios failure code ${e.response.status} getting next-test: ${e.message}` ); } - if ( response.status !== 200 ) { + if ( response?.status !== 200 ) { throw new Error( `nextTest request failed with status ${response.status} ${response}` ); } - return response.data || {}; + return response?.data || null; }; \ No newline at end of file diff --git a/js/node-client/runNextTest.js b/js/node-client/runNextTest.js index 48cbbf0..6bca191 100644 --- a/js/node-client/runNextTest.js +++ b/js/node-client/runNextTest.js @@ -32,9 +32,11 @@ module.exports = async function( options ) { testInfo = await getNextTestInfo( options ); winston.info( 'testInfo', JSON.stringify( testInfo ) ); } - await runTest( testInfo, options ); - winston.debug( 'runTest completed' ); - return; + if ( testInfo ) { + await runTest( testInfo, options ); + winston.debug( 'runTest completed' ); + return; + } } catch( e ) { lastFailure = e;