Skip to content

Commit

Permalink
Fix issue #947 (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric MORAND authored and SBoudrias committed Dec 1, 2016
1 parent e1b95d8 commit f6f4dda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ var Base = module.exports = function Base(args, options) {
this.log = this.env.adapter.log;

// determine the app root
this.contextRoot = this.env.cwd;

var rootPath = findUp.sync('.yo-rc.json', {
cwd: this.env.cwd
});
Expand Down
4 changes: 3 additions & 1 deletion test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ describe('Base', function () {
describe('constructor', function () {
it('set the CWD where `.yo-rc.json` is found', function () {
var projectDir = path.join(__dirname, 'fixtures/dummy-project');
process.chdir(path.join(projectDir, 'subdir'));
var subdir = path.join(projectDir, 'subdir');
process.chdir(subdir);
this.env.cwd = process.cwd();

var dummy = new this.Dummy(['foo'], {
Expand All @@ -63,6 +64,7 @@ describe('Base', function () {

assert.equal(process.cwd(), projectDir);
assert.equal(dummy.destinationPath(), projectDir);
assert.equal(dummy.contextRoot, subdir);
});

it('use the environment options', function () {
Expand Down

0 comments on commit f6f4dda

Please sign in to comment.