Skip to content

Commit

Permalink
fix: support relative path (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 authored and popomore committed Apr 1, 2018
1 parent f81f09b commit 7531faa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ class Command extends BaseCommand {
argv.$0 = undefined;

// read `egg.typescript` from package.json
const baseDir = argv._[0] || argv.baseDir || cwd;
let baseDir = argv._[0] || argv.baseDir || cwd;
if (!path.isAbsolute(baseDir)) baseDir = path.join(cwd, baseDir);
const pkgFile = path.join(baseDir, 'package.json');
if (fs.existsSync(pkgFile)) {
const pkgInfo = require(pkgFile);
Expand Down
9 changes: 9 additions & 0 deletions test/ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ describe('test/ts.test.js', () => {
.end();
});

it('should start app with relative path', () => {
return coffee.fork(eggBin, [ 'dev', './example-ts-pkg' ], { cwd: path.dirname(cwd) })
// .debug()
.expect('stdout', /hi, egg, 12345/)
.expect('stdout', /started/)
.expect('code', 0)
.end();
});

it('should test app', () => {
return coffee.fork(eggBin, [ 'test' ], { cwd })
// .debug()
Expand Down

0 comments on commit 7531faa

Please sign in to comment.