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 @@ -122,7 +122,6 @@ class StartCommand extends Command {
argv.daemon = undefined;

const options = {
cwd: baseDir,
execArgv: context.execArgv,
env,
stdio: 'inherit',
Expand Down
15 changes: 15 additions & 0 deletions test/fixtures/subdir-as-basedir/base-dir/app/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

module.exports = app => {
app.get('/', function* () {
this.body = `hi, ${app.config.framework || 'egg'}`;
});

app.get('/env', function* () {
this.body = app.config.env + ', ' + app.config.pre;
});

app.get('/path', function* () {
this.body = process.env.PATH;
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

exports.keys = '123456';
3 changes: 3 additions & 0 deletions test/fixtures/subdir-as-basedir/base-dir/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "base-dir"
}
3 changes: 3 additions & 0 deletions test/fixtures/subdir-as-basedir/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "subdir-as-basedir"
}
28 changes: 28 additions & 0 deletions test/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,34 @@ describe('test/start.test.js', () => {
assert(result.data.toString() === 'hi, egg');
});
});

describe('subDir as baseDir', () => {
let app;
const rootDir = path.join(__dirname, '..');
const subDir = path.join(__dirname, 'fixtures/subdir-as-basedir/base-dir');

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

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

it('should start', function* () {
app = coffee.fork(eggBin, [ 'start', '--workers=2', subDir ], { cwd: rootDir });
// app.debug();
app.expect('code', 0);

yield sleep(waitTime);

assert(app.stderr === '');
assert(app.stdout.match(/egg started on http:\/\/127\.0\.0\.1:7001/));
const result = yield httpclient.request('http://127.0.0.1:7001');
assert(result.data.toString() === 'hi, egg');
});
});
});

describe('start with daemon', () => {
Expand Down