Skip to content
Closed
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
32 changes: 31 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ module.exports = {
return new BroccoliMergeTrees([tree, instrumentedNode], { overwrite: true });
},

setupPreprocessorRegistry: function() {
var codeCoverageAddon = this;
function iterateAddons(addons) {
addons.forEach(function(addon) {
if (addon.isDevelopingAddon && addon.isDevelopingAddon()) {
addon.addons.push(codeCoverageAddon);
}
iterateAddons(addon.addons);
});
}
iterateAddons(this.project.addons);
},

includedCommands: function () {
return {
'coverage-merge': require('./lib/coverage-merge')
Expand Down Expand Up @@ -143,6 +156,22 @@ module.exports = {
return this._doesTemplateFileExist(relativePath);
},

/**
* Check if a file exists within an in-repo addon
* @param {String} relativePath - path to file
* @returns {Boolean} whether or not the file exists within an in-app addon
*/
_doesFileExistInCurrentProjectInRepoAddons: function(relativePath) {
relativePath = relativePath.split('/').splice(1, 0, 'addon').join('/');
relativePath = path.join('lib', relativePath);

if (this._existsSync(relativePath)) {
return true;
}

return this._doesTemplateFileExist(relativePath);
},

/**
* Check if a template file exists within the current app/addon
* Note: Template files are already compiled into JavaScript files so we must
Expand Down Expand Up @@ -193,7 +222,8 @@ module.exports = {
this._doesFileExistInDummyApp(relativePath) ||
this._doesFileExistInCurrentProjectApp(relativePath) ||
this._doesFileExistInCurrentProjectAddon(relativePath) ||
this._doesFileExistInCurrentProjectAddonModule(relativePath)
this._doesFileExistInCurrentProjectAddonModule(relativePath) ||
this._doesFileExistInCurrentProjectInRepoAddons(relativePath)
);

return !fileExists;
Expand Down