From d973f9467f993487a9c971f74af2b1ec30c46108 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Wed, 21 Feb 2018 13:38:08 -0500 Subject: [PATCH] Use the parent registry for determining JS extensions --- index.js | 5 +++-- test/unit/index-test.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index e70a454d..8e60e4fc 100644 --- a/index.js +++ b/index.js @@ -43,10 +43,11 @@ module.exports = { // Ember Methods - included: function() { + included: function(appOrAddon) { this._super.included.apply(this, arguments); this.fileLookup = {}; + this.parentRegistry = appOrAddon.registry; if (!this._registeredWithBabel && this._isCoverageEnabled()) { let checker = new VersionChecker(this.parent).for('ember-cli-babel', 'npm'); @@ -201,7 +202,7 @@ module.exports = { _getIncludesForDir: function(dir, prefix) { if (fs.existsSync(dir)) { let dirname = path.relative(this.project.root, dir); - let globs = this.registry.extensionsForType('js').map((extension) => `**/*.${extension}`); + let globs = this.parentRegistry.extensionsForType('js').map((extension) => `**/*.${extension}`); return walkSync(dir, { directories: false, globs }).map(file => { let module = prefix + '/' + file.replace(EXT_RE, '.js'); diff --git a/test/unit/index-test.js b/test/unit/index-test.js index 7d096f95..50f9f333 100644 --- a/test/unit/index-test.js +++ b/test/unit/index-test.js @@ -11,9 +11,9 @@ describe('index.js', function() { beforeEach(function() { sandbox = sinon.sandbox.create(); - Index.parent = Index.project = Index.app = Index.IstanbulPlugin = Index.registry = null; + Index.parent = Index.project = Index.app = Index.IstanbulPlugin = Index.parentRegistry = null; sandbox.stub(Index, 'fileLookup').value({}); - sandbox.stub(Index, 'registry').value({ + sandbox.stub(Index, 'parentRegistry').value({ extensionsForType: function() { return ['js']; }