Scenario: I'd like to know the proper way to access the root of a project that's consuming the addon - that also works while testing...
e.g., the addon:
// ember-cli-myaddon/index.js
{
...
contentFor(name) {
if (name ==='body') {
var filePath = path.join(this.app.project.root, 'app/some-file.html')
var file = fs.readFileSync(filePath);
return [file];
}
},
...
}
^ that works when using the addon inside an actual project.
However when I run tests for the addon, this.app.project.root is ~/ember-cli-myaddon/app/some-file.html
When I expect (need) it to be ~/ember-cli-myaddon/tests/dummy/app/some-file.html
Aucun commentaire:
Enregistrer un commentaire