diff --git a/js/Gruntfile.js b/js/Gruntfile.js index 07fe4f1..4f827dd 100644 --- a/js/Gruntfile.js +++ b/js/Gruntfile.js @@ -71,7 +71,10 @@ module.exports = grunt => { const port = grunt.option( 'port' ) ? Number.parseInt( grunt.option( 'port' ), 10 ) : 45367; - const server = new QuickServer(); + const testing = grunt.option( 'testing' ); + const server = new QuickServer( { + isTestMode: testing + } ); server.startServer( port ); server.startMainLoop(); } diff --git a/js/server/QuickServer.js b/js/server/QuickServer.js index 83527fe..59ba85c 100644 --- a/js/server/QuickServer.js +++ b/js/server/QuickServer.js @@ -36,14 +36,23 @@ const jsonHeaders = { let lastBroken = false; class QuickServer { - constructor( rootDir = path.normalize( `${__dirname}/../../../` ) ) { + constructor( options ) { + + options = { + rootDir: path.normalize( `${__dirname}/../../../` ), + isTestMode: false, + ...options + }; // @public {*} this.reportState = {}; // @public {string} - root of your GitHub working copy, relative to the name of the directory that the // currently-executing script resides in - this.rootDir = rootDir; + this.rootDir = options.rootDir; + + // @public {boolean} - whether we are in testing mode. if true, tests are continuously forced to run + this.isTestMode = options.isTestMode; } /** @@ -75,7 +84,7 @@ class QuickServer { } ) ); if ( staleRepos.length || forceTests ) { - forceTests = false; + forceTests = this.isTestMode; winston.info( `QuickServer: stale repos: ${staleRepos}` );