From bfbf1160986c0a7f677665f7e428371eca331d12 Mon Sep 17 00:00:00 2001 From: Stefan Penner Date: Wed, 20 Feb 2019 19:36:10 -0800 Subject: [PATCH] ensure custom tree is still memoized --- index.js | 10 ++++++++++ package.json | 1 + 2 files changed, 11 insertions(+) diff --git a/index.js b/index.js index aa5706e5..204fc0e2 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ /* eslint-env node */ const VersionChecker = require('ember-cli-version-checker'); +const cacheKeyForTree = require('calculate-cache-key-for-tree'); module.exports = { name: 'ember-test-selectors', @@ -74,6 +75,15 @@ module.exports = { } }, + cacheKeyForTree(treeType) { + // ensure our treeForAddon is memoized + if (treeType === 'addon') { + return cacheKeyForTree('addon', this, [this._stripTestSelectors]); + } else { + return cacheKeyForTree(treeType, this); + } + }, + treeForAddon() { // remove our "addon" folder from the build if we're stripping test selectors if (!this._stripTestSelectors) { diff --git a/package.json b/package.json index 43cd2bd5..13fecdec 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "test:strip": "STRIP_TEST_SELECTORS=true ember test" }, "dependencies": { + "calculate-cache-key-for-tree": "^1.1.0", "ember-cli-babel": "^6.8.2", "ember-cli-version-checker": "^3.1.3" },