diff --git a/lib/cmd/debug.js b/lib/cmd/debug.js index ff7abbb7..242e50a0 100644 --- a/lib/cmd/debug.js +++ b/lib/cmd/debug.js @@ -12,14 +12,21 @@ class DebugCommand extends Command { // set default to empty so `--inspect` will always pass to fork inspect: { description: 'V8 Inspector port', - default: newDebugger ? '' : undefined, + default() { + /* istanbul ignore next */ + return newDebugger ? '' : undefined; + }, }, 'inspect-brk': { description: 'whether break at start', }, + debug: { description: 'legacy debugger', - default: newDebugger ? undefined : '', + default() { + /* istanbul ignore next */ + return newDebugger ? undefined : ''; + }, }, }; process.env.EGG_DEBUG = 'true'; diff --git a/lib/command.js b/lib/command.js index 060971d7..3f7a93ee 100644 --- a/lib/command.js +++ b/lib/command.js @@ -35,7 +35,6 @@ class Command extends BaseCommand { // remove unuse args argv.$0 = undefined; - argv.v = undefined; return context; } diff --git a/package.json b/package.json index f8701309..b5fdcc53 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "autod": "^2.9.0", "change-case": "^3.0.1", "co-mocha": "^1.2.0", - "common-bin": "^2.6.0", + "common-bin": "^2.6.1", "debug": "^3.0.1", "detect-port": "^1.2.1", "egg-utils": "^2.2.0", diff --git a/test/lib/cmd/autod.test.js b/test/lib/cmd/autod.test.js index 89b508bc..60024762 100644 --- a/test/lib/cmd/autod.test.js +++ b/test/lib/cmd/autod.test.js @@ -6,10 +6,19 @@ const coffee = require('coffee'); const eggBin = require.resolve('../../../bin/egg-bin.js'); describe('test/lib/cmd/autod.test.js', () => { + it('should autod modify', function* () { + const cwd = path.join(__dirname, '../../fixtures/autod-missing'); + yield coffee.fork(eggBin, [ 'autod' ], { cwd }) + // .debug() + .expect('stdout', /"urllib": "\d+.\d+.\d+/) + .expect('code', 0) + .end(); + }); + it('should autod check fail', function* () { const cwd = path.join(__dirname, '../../fixtures/autod-missing'); yield coffee.fork(eggBin, [ 'autod', '--check' ], { cwd }) - .debug() + // .debug() .expect('code', 1) .expect('stderr', /\[ERROR\] Missing dependencies: \["urllib"\]/) .end(); @@ -18,7 +27,7 @@ describe('test/lib/cmd/autod.test.js', () => { it('should autod check pass', function* () { const cwd = path.join(__dirname, '../../fixtures/autod-exists'); yield coffee.fork(eggBin, [ 'autod', '--check' ], { cwd }) - .debug() + // .debug() .expect('code', 0) .end(); }); diff --git a/test/lib/cmd/cov.test.js b/test/lib/cmd/cov.test.js index 9d83a4c6..d37883b0 100644 --- a/test/lib/cmd/cov.test.js +++ b/test/lib/cmd/cov.test.js @@ -42,7 +42,7 @@ describe('test/lib/cmd/cov.test.js', () => { mm(process.env, 'TESTS', 'test/**/*.test.js'); mm(process.env, 'NYC_CWD', cwd); const child = coffee.fork(eggBin, [ 'cov' ], { cwd }) - .debug() + // .debug() .beforeScript(path.join(__dirname, 'mock-win32.js')) .expect('stdout', /should success/) .expect('stdout', /a\.test\.js/) @@ -79,8 +79,7 @@ describe('test/lib/cmd/cov.test.js', () => { child.expect('stdout', /Statements {3}: 75% \( 3[\/|\\]4 \)/); } - yield child.expect('code', 0) - .end(); + yield child.expect('code', 0).end(); assert(fs.existsSync(path.join(cwd, 'coverage/coverage-final.json'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov-report/index.html'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov.info'))); @@ -101,8 +100,7 @@ describe('test/lib/cmd/cov.test.js', () => { child.expect('stdout', /Statements {3}: 75% \( 3[\/|\\]4 \)/); } - yield child.expect('code', 0) - .end(); + yield child.expect('code', 0).end(); assert(fs.existsSync(path.join(cwd, 'coverage/coverage-final.json'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov-report/index.html'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov.info'))); @@ -123,8 +121,7 @@ describe('test/lib/cmd/cov.test.js', () => { child.expect('stdout', /Statements {3}: 75% \( 3[\/|\\]4 \)/); } - yield child.expect('code', 0) - .end(); + yield child.expect('code', 0).end(); assert(fs.existsSync(path.join(cwd, 'coverage/coverage-final.json'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov-report/index.html'))); assert(fs.existsSync(path.join(cwd, 'coverage/lcov.info'))); diff --git a/test/lib/cmd/debug.test.js b/test/lib/cmd/debug.test.js index c9a7f7d3..594cffa3 100644 --- a/test/lib/cmd/debug.test.js +++ b/test/lib/cmd/debug.test.js @@ -37,7 +37,7 @@ describe('test/lib/cmd/debug.test.js', () => { it('should debug with $NODE_DEBUG_OPTION', () => { const env = Object.assign({}, process.env, { NODE_DEBUG_OPTION: '--inspect=5555' }); return coffee.fork(eggBin, [ 'debug' ], { cwd, env }) - .debug() + // .debug() .expect('stderr', /Debugger listening.*5555/) .expect('stdout', /"workers":1/) .expect('code', 0)