From d7413196e1ff412915b4f488e9dd32f4fdcc4c12 Mon Sep 17 00:00:00 2001 From: Blaine Bublitz Date: Mon, 18 Dec 2017 13:16:37 -0700 Subject: [PATCH] chore: Rename to forcedFlags & specify it in launch opts instead of constructor --- index.js | 4 ++-- test/fixtures/nodeflags_only.js | 9 +++++---- test/fixtures/v8flags_config.js | 5 +++-- test/index.js | 8 ++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index ff0daea..7415dcf 100644 --- a/index.js +++ b/index.js @@ -191,8 +191,8 @@ Liftoff.prototype.launch = function (opts, fn) { var env = this.buildEnvironment(opts); - var nodeFlags = getNodeFlags.arrayOrFunction(this.nodeFlags, env); - flaggedRespawn(flags, process.argv, nodeFlags, execute.bind(this)); + var forcedFlags = getNodeFlags.arrayOrFunction(opts.forcedFlags, env); + flaggedRespawn(flags, process.argv, forcedFlags, execute.bind(this)); function execute(ready, child, argv) { if (child !== process) { diff --git a/test/fixtures/nodeflags_only.js b/test/fixtures/nodeflags_only.js index 5ce8cc2..477c951 100644 --- a/test/fixtures/nodeflags_only.js +++ b/test/fixtures/nodeflags_only.js @@ -2,15 +2,16 @@ const Liftoff = require('../..'); const Test = new Liftoff({ name: 'test', - nodeFlags: function(opts, env) { - return ['--lazy']; - }, }); Test.on('respawn', function(execArgv) { console.log('saw respawn', execArgv); }); -Test.launch({}, function(env, argv) { +Test.launch({ + forcedFlags: function(env) { + return ['--lazy']; + }, +}, function(env, argv) { console.error(argv.slice(1).join(' ')); }); diff --git a/test/fixtures/v8flags_config.js b/test/fixtures/v8flags_config.js index dd40fb9..6fa6f98 100644 --- a/test/fixtures/v8flags_config.js +++ b/test/fixtures/v8flags_config.js @@ -3,13 +3,14 @@ const Liftoff = require('../..'); const Test = new Liftoff({ name: 'test', v8flags: ['--harmony'], - nodeFlags: ['--lazy'], }); Test.on('respawn', function(flags, proc) { console.log('saw respawn', flags); }); -Test.launch({}, function(env, argv) { +Test.launch({ + forcedFlags: ['--lazy'], +}, function(env, argv) { console.error(argv.slice(1).join(' ')); }); diff --git a/test/index.js b/test/index.js index 715e182..687a700 100644 --- a/test/index.js +++ b/test/index.js @@ -245,7 +245,7 @@ describe('Liftoff', function () { }); }); - it('should respawn if v8flag is set by opts.nodeFlags', function(done) { + it('should respawn if v8flag is set by opts.forcedFlags', function(done) { exec('node test/fixtures/v8flags_config.js 123', cb); function cb(err, stdout, stderr) { @@ -259,7 +259,7 @@ describe('Liftoff', function () { } }); - it('should respawn if v8flag is set by both cli flag and opts.nodeFlags', function(done) { + it('should respawn if v8flag is set by both cli flag and opts.forcedFlags', function(done) { exec('node test/fixtures/v8flags_config.js 123 --harmony abc', cb); function cb(err, stdout, stderr) { @@ -291,7 +291,7 @@ describe('Liftoff', function () { }); }); - it('should respawn if v8flags is empty but nodeFlags are specified', + it('should respawn if v8flags is empty but forcedFlags are specified', function(done) { exec('node test/fixtures/nodeflags_only.js 123', cb); @@ -505,7 +505,7 @@ describe('Liftoff', function () { logFailure.push({ moduleName: moduleName, error: error }); }); app.on('require', function(moduleName, module) { - logRequire.push({ moduleName: moduleName, module: module }); + logRequire.push({ moduleName: moduleName, module: module }); }); app.launch({}, function(env) { expect(env.configFiles).to.deep.equal({