diff --git a/addon/.eslintrc.js b/addon-test-support/.eslintrc.js similarity index 100% rename from addon/.eslintrc.js rename to addon-test-support/.eslintrc.js diff --git a/addon/index.js b/addon-test-support/index.js similarity index 100% rename from addon/index.js rename to addon-test-support/index.js diff --git a/addon/utils/bind-data-test-attributes.js b/addon-test-support/utils/bind-data-test-attributes.js similarity index 100% rename from addon/utils/bind-data-test-attributes.js rename to addon-test-support/utils/bind-data-test-attributes.js diff --git a/addon/.gitkeep b/addon/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/index.js b/index.js index 85cc1628..9997386d 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ /* eslint-env node */ const VersionChecker = require('ember-cli-version-checker'); +const Funnel = require('broccoli-funnel'); module.exports = { name: 'ember-test-selectors', @@ -79,11 +80,20 @@ module.exports = { } }, - treeForAddon() { - // remove our "addon" folder from the build if we're stripping test selectors - if (!this._stripTestSelectors) { - return this._super.treeForAddon.apply(this, arguments); - } + treeForAddonTestSupport(tree) { + // intentionally not calling _super here + // so that can have our `import`'s be + // import testSelector from 'ember-test-selectors'; + + let namespacedTree = new Funnel(tree, { + srcDir: '/', + destDir: `/${this.moduleName()}`, + annotation: `Addon#treeForTestSupport (${this.name})`, + }); + + return this.preprocessJs(namespacedTree, '/', this.name, { + registry: this.registry, + }); }, preprocessTree(type, tree) {