diff --git a/lib/start-cluster b/lib/start-cluster index fb96cda1..ffe654b1 100755 --- a/lib/start-cluster +++ b/lib/start-cluster @@ -17,16 +17,17 @@ commander const baseDir = commander.baseDir; const workers = commander.cluster ? Number(commander.cluster) : 1; const port = commander.port; -const eggPath = commander.eggPath; +const customEgg = commander.eggPath; -assert(eggPath, 'eggPath required, missing any egg frameworks?'); +assert(customEgg, 'eggPath required, missing any egg frameworks?'); const options = { baseDir, workers, port, + customEgg, }; -debug('eggPath:%s options:%j', eggPath, options); +debug('eggPath:%s options:%j', customEgg, options); -require(eggPath).startCluster(options); +require(customEgg).startCluster(options); diff --git a/test/egg-debug.test.js b/test/egg-debug.test.js index b59eb14a..f778a542 100644 --- a/test/egg-debug.test.js +++ b/test/egg-debug.test.js @@ -9,6 +9,7 @@ const net = require('net'); describe('egg-bin debug', () => { const eggBin = require.resolve('../bin/egg-bin.js'); const appdir = path.join(__dirname, 'fixtures/demo-app'); + const customEgg = path.join(appdir, 'node_modules/aliyun-egg'); before(() => { rimraf.sync(path.join(appdir, 'node_modules/iron-node')); @@ -19,7 +20,7 @@ describe('egg-bin debug', () => { it('should startCluster success', done => { coffee.fork(eggBin, [ 'debug' ], { cwd: appdir }) // .debug() - .expect('stdout', /,"workers":1}/) + .expect('stdout', /,"workers":1,/) .expect('code', 0) .end(done); }); @@ -27,7 +28,7 @@ describe('egg-bin debug', () => { it('should startCluster with port', done => { coffee.fork(eggBin, [ 'debug', '--port', '6001' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1,"port":"6001"}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"port":"6001","customEgg":"${customEgg}"}\n`) .expect('code', 0) .end(done); }); @@ -44,7 +45,7 @@ describe('egg-bin debug', () => { it('should auto detect available port', done => { coffee.fork(eggBin, [ 'debug' ], { cwd: appdir }) // .debug() - .expect('stdout', /,"workers":1}/) + .expect('stdout', /,"workers":1,/) .expect('stderr', /\[egg-bin] server port 7001 is in use/) .expect('code', 0) .end(done); diff --git a/test/egg-dev.test.js b/test/egg-dev.test.js index 71e196f0..d52251db 100644 --- a/test/egg-dev.test.js +++ b/test/egg-dev.test.js @@ -7,11 +7,12 @@ const net = require('net'); describe('egg-bin dev', () => { const eggBin = require.resolve('../bin/egg-bin.js'); const appdir = path.join(__dirname, 'fixtures/demo-app'); + const customEgg = path.join(appdir, 'node_modules/aliyun-egg'); it('should startCluster success', done => { coffee.fork(eggBin, [ 'dev' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"customEgg":"${customEgg}"}\n`) .expect('code', 0) .end(done); }); @@ -19,7 +20,7 @@ describe('egg-bin dev', () => { it('should startCluster with port', done => { coffee.fork(eggBin, [ 'dev', '--port', '6001' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1,"port":"6001"}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"port":"6001","customEgg":"${customEgg}"}\n`) .expect('code', 0) .end(done); }); @@ -36,7 +37,7 @@ describe('egg-bin dev', () => { it('should auto detect available port', done => { coffee.fork(eggBin, [ 'dev' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"customEgg":"${customEgg}"}\n`) .expect('stderr', /\[egg-bin] server port 7001 is in use/) .expect('code', 0) .end(done); @@ -46,7 +47,7 @@ describe('egg-bin dev', () => { it.skip('should startCluster with execArgv --debug', done => { coffee.fork(eggBin, [ 'dev', '--debug=7000' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"customEgg":"${customEgg}"}\n`) .expect('stderr', /Debugger listening on .*7000/) .expect('code', 0) .end(done); @@ -55,7 +56,7 @@ describe('egg-bin dev', () => { it.skip('should startCluster with execArgv --inspect', done => { coffee.fork(eggBin, [ 'dev', '--inspect=7000' ], { cwd: appdir }) // .debug() - .expect('stdout', `{"baseDir":"${appdir}","workers":1}\n`) + .expect('stdout', `{"baseDir":"${appdir}","workers":1,"customEgg":"${customEgg}"}\n`) .expect('stderr', /Debugger listening on .*7000/) .expect('code', 0) .end(done);