Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/cmd/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class StartCommand extends Command {
const logDir = path.join(env.HOME, 'logs', pkgInfo.name);

argv.title = argv.title || `egg-server-${pkgInfo.name}`;
argv.title = undefined;

// adjust env for win
let envPath = env.PATH || env.Path;
Expand Down
34 changes: 33 additions & 1 deletion test/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ describe('test/start.test.js', () => {
// app.debug();
app.expect('code', 0);

yield sleep('15s');
yield sleep(waitTime);

assert(app.stderr === '');
assert(app.stdout.includes('--title=egg-server-example'));
assert(app.stdout.includes('"title":"egg-server-example"'));
assert(app.stdout.match(/custom-framework started on http:\/\/127\.0\.0\.1:7001/));
assert(app.stdout.includes('app_worker#2:'));
assert(!app.stdout.includes('app_worker#3:'));
Expand Down Expand Up @@ -128,6 +130,36 @@ describe('test/start.test.js', () => {
});
});

describe('--title', () => {
let app;

before(function* () {
yield utils.cleanup(fixturePath);
});

after(function* () {
app.proc.kill('SIGTERM');
yield utils.cleanup(fixturePath);
});

it('should start', function* () {
app = coffee.fork(eggBin, [ 'start', '--workers=2', '--title=egg-test', fixturePath ]);
// app.debug();
app.expect('code', 0);

yield sleep(waitTime);

assert(app.stderr === '');
assert(app.stdout.includes('--title=egg-test'));
assert(app.stdout.includes('"title":"egg-test"'));
assert(app.stdout.match(/custom-framework started on http:\/\/127\.0\.0\.1:7001/));
assert(app.stdout.includes('app_worker#2:'));
assert(!app.stdout.includes('app_worker#3:'));
const result = yield httpclient.request('http://127.0.0.1:7001');
assert(result.data.toString() === 'hi, egg');
});
});

describe('--port', () => {
let app;

Expand Down